Updated loading states and error states accross app

This commit is contained in:
2025-10-06 14:21:56 +01:00
parent ad0ffa6df6
commit f275f50383
25 changed files with 377 additions and 101 deletions

View File

@@ -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");
}