- /login: setup/login/TOTP states driven by server error codes, fixed-height error slot - console layout: GET /auth/session gate, redirect to /login, account popover (change password, logout) - home: six dashboard sections with SSE-driven refresh, automation switch and read-only reconcile toggle - settings tabs: downloaders, media servers, library roots, path mappings, site credentials, API keys (one-time plaintext), Pi upstream, cache/organize/retention/budget, automation - engine: runs list (status/name filters, cursor paging, stats tiles), run detail (step timeline, json payloads, signals, cancel) - audit: filterable list with detail sheet - vite: allow repo root in server.fs so deno-installed deps under node_modules/.deno load in dev Co-Authored-By: Claude Opus 5.5 <[email protected]>
14 lines
449 B
TypeScript
14 lines
449 B
TypeScript
import { useQuery } from "@tanstack/react-query";
|
|
import type { Dashboard } from "@umt/contracts";
|
|
import { apiData } from "~/lib/api.ts";
|
|
import { qk } from "~/lib/query-keys.ts";
|
|
|
|
/** 首页聚合;SSE 事件触发 invalidate,另有 60 秒兜底轮询 */
|
|
export function useDashboard() {
|
|
return useQuery({
|
|
queryKey: qk.dashboard,
|
|
queryFn: ({ signal }) => apiData<Dashboard>("/dashboard", { signal }),
|
|
refetchInterval: 60_000,
|
|
});
|
|
}
|