buster/web/src/api/query_keys/dashboard.ts

19 lines
619 B
TypeScript
Raw Normal View History

2025-02-14 05:28:45 +08:00
import { queryOptions } from '@tanstack/react-query';
2025-02-14 14:04:30 +08:00
import type { BusterDashboard, BusterDashboardResponse } from '@/api/asset_interfaces';
2025-02-14 05:28:45 +08:00
const dashboardGetList = queryOptions<BusterDashboard[]>({
queryKey: ['dashboard', 'list'] as const,
staleTime: 10 * 1000
});
const dashboardGetDashboard = (dashboardId: string) =>
queryOptions<BusterDashboardResponse>({
queryKey: ['dashboard', 'get', dashboardId] as const,
staleTime: 10 * 1000
});
export const dashboardQueryKeys = {
'/dashboards/get:getDashboardState': dashboardGetDashboard,
'/dashboards/list:getDashboardsList': dashboardGetList
};