mirror of https://github.com/jetkvm/kvm.git
fix: handle network data fetch errors in settings
This commit is contained in:
parent
6a2a33b00a
commit
f56f1d94e3
|
|
@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue