mirror of
https://github.com/hamster1963/nezha-dash.git
synced 2025-04-24 21:10:45 +08:00
feat: new fetch interval env
This commit is contained in:
parent
81ea88443e
commit
45a5d6e050
@ -1,2 +1,3 @@
|
||||
NezhaBaseUrl=http://0.0.0.0:8008
|
||||
NezhaAuth=5hAY3QX6Nl9B3UOQgB26KdsdS1dsdUdM
|
||||
NEXT_PUBLIC_NezhaFetchInterval=2
|
@ -7,7 +7,9 @@ import useSWR from "swr";
|
||||
|
||||
export default function ServerListClient() {
|
||||
const { data } = useSWR<ServerApi>("/api/server", nezhaFetcher, {
|
||||
refreshInterval: 3000,
|
||||
refreshInterval: process.env.NEXT_PUBLIC_NezhaFetchInterval
|
||||
? Number(process.env.NEXT_PUBLIC_NezhaFetchInterval)
|
||||
: 2000,
|
||||
});
|
||||
if (!data) return null;
|
||||
const sortedResult = data.result.sort((a, b) => a.id - b.id);
|
||||
|
@ -9,9 +9,7 @@ import { Loader } from "@/components/loading/Loader";
|
||||
import { ServerApi } from "@/app/types/nezha-api";
|
||||
|
||||
export default function ServerOverviewClient() {
|
||||
const { data } = useSWR<ServerApi>("/api/server", nezhaFetcher, {
|
||||
refreshInterval: 30000,
|
||||
});
|
||||
const { data } = useSWR<ServerApi>("/api/server", nezhaFetcher);
|
||||
|
||||
return (
|
||||
<section className="grid grid-cols-2 gap-4 md:grid-cols-4">
|
||||
|
@ -13,8 +13,6 @@ export default function MainLayout({ children }: DashboardProps) {
|
||||
<div className="flex min-h-screen w-full flex-col">
|
||||
<main className="flex min-h-[calc(100vh_-_theme(spacing.16))] flex-1 flex-col gap-4 bg-muted/40 p-4 md:p-10 md:pt-8">
|
||||
<Header />
|
||||
{/* <BlurLayers /> */}
|
||||
{/* <Nav /> */}
|
||||
{children}
|
||||
<Footer />
|
||||
</main>
|
||||
|
Loading…
Reference in New Issue
Block a user