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 = {
|
|
|
|
'/dashboards/get:getDashboardState': dashboardGetDashboard,
|
|
|
|
'/dashboards/list:getDashboardsList': dashboardGetList
|
|
|
|
};
|