2025-02-14 05:28:45 +08:00
|
|
|
import { queryOptions } from '@tanstack/react-query';
|
2025-02-18 04:20:34 +08:00
|
|
|
import type {
|
|
|
|
BusterDashboardListItem,
|
|
|
|
BusterDashboardResponse
|
2025-03-08 07:02:56 +08:00
|
|
|
} from '@/api/asset_interfaces/dashboard';
|
|
|
|
import { DashboardsListRequest } from '../request_interfaces/dashboards/interfaces';
|
2025-02-14 05:28:45 +08:00
|
|
|
|
2025-03-08 07:02:56 +08:00
|
|
|
const dashboardGetList = (filters: Omit<DashboardsListRequest, 'page_token' | 'page_size'>) =>
|
2025-02-18 04:20:34 +08:00
|
|
|
queryOptions<BusterDashboardListItem[]>({
|
|
|
|
queryKey: ['dashboard', 'list', filters] as const,
|
2025-03-13 07:12:27 +08:00
|
|
|
staleTime: 10 * 1000,
|
|
|
|
initialData: [],
|
|
|
|
initialDataUpdatedAt: 0
|
2025-02-18 04:20:34 +08:00
|
|
|
});
|
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
|
|
|
};
|