diff --git a/PROJECTS/advanced/monitor-the-situation-dashboard/frontend/src/api/snapshot.ts b/PROJECTS/advanced/monitor-the-situation-dashboard/frontend/src/api/snapshot.ts new file mode 100644 index 00000000..3c4365da --- /dev/null +++ b/PROJECTS/advanced/monitor-the-situation-dashboard/frontend/src/api/snapshot.ts @@ -0,0 +1,21 @@ +// ©AngelaMos | 2026 +// snapshot.ts + +import { useQuery } from '@tanstack/react-query' +import { apiClient } from '@/core/api' + +export type Snapshot = Record + +export const SNAPSHOT_KEY = ['snapshot'] as const + +export function useSnapshot() { + return useQuery({ + queryKey: SNAPSHOT_KEY, + queryFn: async (): Promise => { + const res = await apiClient.get('/v1/snapshot') + return res.data + }, + staleTime: Number.POSITIVE_INFINITY, + gcTime: Number.POSITIVE_INFINITY, + }) +}