Standardise loading state naming across dashboard hooks

This commit is contained in:
2026-04-21 19:12:43 +02:00
parent 094fb4fece
commit b3eb5dc6ec
9 changed files with 25 additions and 25 deletions

View File

@@ -21,7 +21,7 @@ export interface UseJailDistributionResult {
/** Total ban count for the selected window. */
total: number;
/** True while a fetch is in flight. */
isLoading: boolean;
loading: boolean;
/** Error message or `null`. */
error: string | null;
/** Re-fetch the data immediately. */
@@ -45,7 +45,7 @@ export function useJailDistribution(
): UseJailDistributionResult {
const [jails, setJails] = useState<JailBanCount[]>([]);
const [total, setTotal] = useState<number>(0);
const [isLoading, setIsLoading] = useState<boolean>(true);
const [loading, setLoading] = useState<boolean>(true);
const [error, setError] = useState<string | null>(null);
const abortRef = useRef<AbortController | null>(null);
@@ -55,7 +55,7 @@ export function useJailDistribution(
const controller = new AbortController();
abortRef.current = controller;
setIsLoading(true);
setLoading(true);
setError(null);
fetchBansByJail(timeRange, origin, "fail2ban", controller.signal)
@@ -70,7 +70,7 @@ export function useJailDistribution(
})
.finally(() => {
if (!controller.signal.aborted) {
setIsLoading(false);
setLoading(false);
}
});
}, [timeRange, origin]);
@@ -82,5 +82,5 @@ export function useJailDistribution(
};
}, [load]);
return { jails, total, isLoading, error, reload: load };
return { jails, total, loading, error, reload: load };
}