buster/web/src/api/asset_interfaces/dashboard/queryKeys.ts

19 lines
609 B
TypeScript
Raw Normal View History

2025-02-14 05:28:45 +08:00
import { queryOptions } from '@tanstack/react-query';
import type { BusterDashboard, BusterDashboardResponse } from './interfaces';
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
};