import { useQuery } from "@tanstack/react-query"; import { Space } from "tdesign-react"; import type { HealthResponse } from "../../../shared/api"; import { APP } from "../../../shared/app"; export function DashboardPage() { const { data: health } = useQuery({ queryFn: fetchHealth, queryKey: ["health"], refetchInterval: 30000, staleTime: 5000, }); return (

欢迎使用 {APP.title}

在此构建你的应用。以下是 /health API 的返回数据(前后端联调示例):

{health &&
{JSON.stringify(health, null, 2)}
}
); } async function fetchHealth(): Promise { const response = await fetch("/health"); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; }