update: adjust the refreshInterval

This commit is contained in:
hamster1963 2024-07-27 11:07:57 +08:00
parent 73700477ed
commit 5dbf12b983
2 changed files with 4 additions and 2 deletions

View File

@ -6,7 +6,7 @@ import useSWR from "swr";
export default function ServerListClient() { export default function ServerListClient() {
const { data } = useSWR('/api/server', nezhaFetcher, { const { data } = useSWR('/api/server', nezhaFetcher, {
refreshInterval: 2000, refreshInterval: 3000,
}); });
if (!data) return null; if (!data) return null;
const sortedResult = data.result.sort((a: any, b: any) => a.id - b.id); const sortedResult = data.result.sort((a: any, b: any) => a.id - b.id);

View File

@ -8,7 +8,9 @@ import { formatBytes, nezhaFetcher } from "@/lib/utils";
import { Loader } from "@/components/loading/Loader"; import { Loader } from "@/components/loading/Loader";
export default function ServerOverviewClient() { export default function ServerOverviewClient() {
const { data } = useSWR('/api/server', nezhaFetcher); const { data } = useSWR('/api/server', nezhaFetcher, {
refreshInterval: 30000
});
return ( return (
<section className="grid md:grid-cols-4 gap-4 grid-cols-2"> <section className="grid md:grid-cols-4 gap-4 grid-cols-2">