Updated loading states and error states accross app
This commit is contained in:
@@ -4,10 +4,14 @@ import { CAM_BASE } from "../utils/config";
|
||||
|
||||
const base_url = `${CAM_BASE}/api`;
|
||||
|
||||
const fetch_url = `http://100.82.205.44/api/fetch-config?id=Colour`;
|
||||
console.log(fetch_url);
|
||||
const fetchCameraSideConfig = async ({ queryKey }: { queryKey: string[] }) => {
|
||||
const [, cameraSide] = queryKey;
|
||||
const fetchUrl = `${base_url}/fetch-config?id=${cameraSide}`;
|
||||
const response = await fetch(fetchUrl);
|
||||
const response = await fetch(fetchUrl, {
|
||||
signal: AbortSignal.timeout(500),
|
||||
});
|
||||
if (!response.ok) throw new Error("cannot react cameraSide ");
|
||||
return response.json();
|
||||
};
|
||||
@@ -53,5 +57,6 @@ export const useFetchCameraConfig = (cameraSide: string) => {
|
||||
isError: fetchedConfigQuery.isError,
|
||||
updateCameraConfig: updateConfigMutation.mutate,
|
||||
updateCameraConfigError: updateConfigMutation.error,
|
||||
updateCameraConfigLoading: updateConfigMutation.isPending,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user