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

25 lines
729 B
TypeScript
Raw Normal View History

2025-02-14 05:28:45 +08:00
import { queryOptions } from '@tanstack/react-query';
2025-02-18 04:20:34 +08:00
import type {
BusterDashboard,
BusterDashboardListItem,
BusterDashboardResponse
} from '@/api/asset_interfaces';
import { DashboardListFilters } from '@/context/Dashboards/DashboardListProvider/interfaces';
2025-02-14 05:28:45 +08:00
2025-02-18 04:20:34 +08:00
const dashboardGetList = (filters: DashboardListFilters) =>
queryOptions<BusterDashboardListItem[]>({
queryKey: ['dashboard', 'list', filters] as const,
staleTime: 10 * 1000
});
2025-02-14 05:28:45 +08:00
const dashboardGetDashboard = (dashboardId: string) =>
queryOptions<BusterDashboardResponse>({
queryKey: ['dashboard', 'get', dashboardId] as const,
staleTime: 10 * 1000
});
export const dashboardQueryKeys = {
2025-03-05 00:45:55 +08:00
dashboardGetDashboard,
dashboardGetList
2025-02-14 05:28:45 +08:00
};