up
deploy to danak / build_and_deploy (push) Has been cancelled

This commit is contained in:
2026-06-26 16:05:11 +03:30
parent 0526741e76
commit 9ce07ed3c2
4 changed files with 40 additions and 3 deletions
@@ -0,0 +1,12 @@
import { useQuery } from '@tanstack/react-query';
import * as api from '../service/DashboardService';
const DASHBOARD_COUNTS_REFETCH_MS = 2 * 60 * 1000;
export const useGetDashboardCounts = () => {
return useQuery({
queryKey: ['dashboard-counts'],
queryFn: () => api.getDashboardCounts(),
refetchInterval: DASHBOARD_COUNTS_REFETCH_MS,
});
};
@@ -0,0 +1,14 @@
import axios from '@/config/axios';
import type { BaseResponse } from '@/shared/types/Types';
export type DashboardCountsType = {
requestsCount: number;
invoicesCount: number;
ordersCount: number;
paymentsCount: number;
};
export const getDashboardCounts = async (): Promise<BaseResponse<DashboardCountsType>> => {
const { data } = await axios.get<BaseResponse<DashboardCountsType>>('/public/dashboard/counts');
return data;
};