Files
Mav-Mobile-UI/src/hooks/useStoreDispatch.ts
Toba Ojo f35e2f9fb5 - added store and forward
- amended sighting ammend endpoint
2025-11-11 10:43:14 +00:00

20 lines
517 B
TypeScript

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 };
};