Fix: updateTrigger val

This commit is contained in:
Br0wnHammer
2026-01-21 18:47:38 +05:30
parent dd259fea89
commit b34dbec3cf
2 changed files with 11 additions and 19 deletions
+2 -7
View File
@@ -412,19 +412,14 @@ export const usePauseMonitor = () => {
try {
setIsLoading(true);
const res = await networkService.pauseMonitorById({ monitorId });
const updatedMonitor = res.data.data;
createToast({
body: updatedMonitor.isActive
body: res.data.data.isActive
? "Monitor resumed successfully"
: "Monitor paused successfully",
});
if (triggerUpdate) {
triggerUpdate();
}
return updatedMonitor;
triggerUpdate();
} catch (error) {
setError(error);
return null;
} finally {
setIsLoading(false);
}
+9 -12
View File
@@ -80,13 +80,13 @@ const UptimeCreate = ({ isClone = false }) => {
const [isFetchingMonitor] = useFetchMonitorById({
monitorId,
setMonitor,
updateTrigger: true,
updateTrigger,
});
// Fetch games
const [isFetchingGames] = useFetchMonitorGames({
setGames,
triggerUpdate: true,
updateTrigger,
});
// Combine the loading states
@@ -283,13 +283,6 @@ const UptimeCreate = ({ isClone = false }) => {
}));
};
const handlePause = async () => {
const updatedMonitor = await pauseMonitor({ monitorId });
if (updatedMonitor) {
setMonitor((prev) => ({ ...prev, isActive: updatedMonitor.isActive }));
}
};
const handleRemove = async (event) => {
event.preventDefault();
const TEMP_MONITOR = { id: monitor.id };
@@ -427,8 +420,7 @@ const UptimeCreate = ({ isClone = false }) => {
<Button
variant="contained"
color="secondary"
loading={isPausing}
disabled={isBusy}
loading={isBusy}
startIcon={
monitor?.isActive ? (
<Icon
@@ -442,7 +434,12 @@ const UptimeCreate = ({ isClone = false }) => {
/>
)
}
onClick={handlePause}
onClick={() => {
pauseMonitor({
monitorId: monitor?.id,
triggerUpdate,
});
}}
>
{monitor?.isActive ? t("pause") : t("resume")}
</Button>