import { useQuery } from "@tanstack/react-query"; import { CAM_BASE } from "../utils/config"; const getStoreData = async () => { const response = await fetch(`${CAM_BASE}/Store/diagnostics-json`); if (!response.ok) throw new Error("Cannot get store data"); return response.json(); }; export const useStoreDispatch = () => { const storeQuery = useQuery({ queryKey: ["getStoreData"], queryFn: getStoreData, refetchInterval: 1000, refetchOnWindowFocus: true, }); return { storeQuery }; };