Updated loading states and error states accross app
This commit is contained in:
@@ -8,7 +8,10 @@ import type { zoomConfig, ZoomInOptions } from "../types/types";
|
||||
|
||||
async function zoomIn(options: ZoomInOptions) {
|
||||
const response = await fetch(
|
||||
`${CAM_BASE}/Ip${options.camera}-command?magnification=${options.multiplier}x`
|
||||
`${CAM_BASE}/Ip${options.camera}-command?magnification=${options.multiplier}x`,
|
||||
{
|
||||
signal: AbortSignal.timeout(500),
|
||||
}
|
||||
);
|
||||
if (!response.ok) {
|
||||
throw new Error("Cannot reach camera zoom endpoint");
|
||||
@@ -21,7 +24,9 @@ async function fetchZoomInConfig({
|
||||
queryKey,
|
||||
}: QueryFunctionContext<[string, zoomConfig]>) {
|
||||
const [, { camera }] = queryKey;
|
||||
const response = await fetch(`${CAM_BASE}/Ip${camera}-inspect`);
|
||||
const response = await fetch(`${CAM_BASE}/Ip${camera}-inspect`, {
|
||||
signal: AbortSignal.timeout(500),
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw new Error("Cannot get camera zoom settings");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user