fix: handle network data fetch errors in settings

This commit is contained in:
Adam Shiervani 2025-10-14 21:14:31 +02:00
parent 6a2a33b00a
commit f56f1d94e3
1 changed files with 12 additions and 3 deletions

View File

@ -175,9 +175,18 @@ export default function SettingsNetworkRoute() {
} else { } else {
// If the settings are saved successfully, fetch the latest network data and reset the form // If the settings are saved successfully, fetch the latest network data and reset the form
// We do this so we get all the form state values, for stuff like is the form dirty, etc... // We do this so we get all the form state values, for stuff like is the form dirty, etc...
const networkData = await fetchNetworkData();
reset(networkData.settings); try {
notifications.success("Network settings saved"); const networkData = await fetchNetworkData();
if (!networkData) {
return notifications.error("Failed to fetch network data");
}
reset(networkData.settings);
notifications.success("Network settings saved");
} catch (error) {
console.error("Failed to fetch network data:", error);
}
} }
}); });
}; };