more enhancements to loading and error feedback
This commit is contained in:
@@ -70,11 +70,13 @@ export const useWifiAndModem = () => {
|
||||
mutationKey: ["updateWifiSettings"],
|
||||
mutationFn: (wifiConfig: WifiConfig) => updateWifiSettings(wifiConfig),
|
||||
onError: (error) => {
|
||||
toast.error("Failed to update WiFi settings");
|
||||
toast.error("Failed to update WiFi settings", { id: "wiFiSettings" });
|
||||
console.error(error);
|
||||
},
|
||||
onSuccess: () => {
|
||||
toast.success("WiFi settings updated successfully");
|
||||
toast.success("WiFi settings updated successfully", {
|
||||
id: "wiFiSettings",
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -87,20 +89,24 @@ export const useWifiAndModem = () => {
|
||||
mutationKey: ["updateModemSettings"],
|
||||
mutationFn: (modemConfig: ModemConfig) => updateModemSettings(modemConfig),
|
||||
onError: (error) => {
|
||||
toast.error("Failed to update Modem settings");
|
||||
toast.error("Failed to update Modem settings", { id: "modemSettings" });
|
||||
console.error(error);
|
||||
},
|
||||
onSuccess: () => {
|
||||
toast.success("Modem settings updated successfully");
|
||||
toast.success("Modem settings updated successfully", {
|
||||
id: "modemSettings",
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (wifiQuery.isError) toast.error("Cannot get WiFi settings");
|
||||
if (wifiQuery.isError)
|
||||
toast.error("Cannot get WiFi settings", { id: "wiFiSettings" });
|
||||
}, [wifiQuery?.error?.message, wifiQuery.isError]);
|
||||
|
||||
useEffect(() => {
|
||||
if (modemQuery.isError) toast.error("Cannot get Modem settings");
|
||||
if (modemQuery.isError)
|
||||
toast.error("Cannot get Modem settings", { id: "modemSettings" });
|
||||
}, [modemQuery?.error?.message, modemQuery.isError]);
|
||||
return {
|
||||
wifiQuery,
|
||||
|
||||
Reference in New Issue
Block a user