17 lines
502 B
TypeScript
17 lines
502 B
TypeScript
"use client"
|
|
|
|
import { useQuery } from "@tanstack/react-query"
|
|
import { useAuthApi } from "@/shared/useApi"
|
|
import type { HomeDashboardQuery, HomeDashboardResponse } from "@garage/api"
|
|
|
|
export type DashboardData = HomeDashboardResponse & Record<string, any>
|
|
|
|
export function useDashboardData(filters?: HomeDashboardQuery) {
|
|
const api = useAuthApi()
|
|
|
|
return useQuery<DashboardData>({
|
|
queryKey: ["home", "dashboard", filters],
|
|
queryFn: () => api.home.dashboard(filters),
|
|
})
|
|
}
|