- added store and forward
- amended sighting ammend endpoint
This commit is contained in:
19
src/hooks/useStoreDispatch.ts
Normal file
19
src/hooks/useStoreDispatch.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
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 };
|
||||
};
|
||||
Reference in New Issue
Block a user