- more addition bugfixes

This commit is contained in:
2025-11-04 15:29:48 +00:00
parent 61894c0c42
commit c127ce8a8c
9 changed files with 87 additions and 62 deletions

View File

@@ -20,13 +20,13 @@ async function zoomIn(options: ZoomInOptions) {
async function fetchZoomInConfig({ queryKey }: QueryFunctionContext<[string, zoomConfig]>) {
const [, { camera }] = queryKey;
const response = await fetch(`${CAM_BASE}/Ip${camera}-command`, {
const response = await fetch(`${CAM_BASE}/api/fetch-config?id=Ip${camera}`, {
signal: AbortSignal.timeout(500),
});
if (!response.ok) {
throw new Error("Cannot get camera zoom settings");
}
return response.text();
return response.json();
}
//change to string
export const useCameraZoom = (options: zoomConfig) => {
@@ -46,7 +46,7 @@ export const useCameraZoom = (options: zoomConfig) => {
});
useEffect(() => {
if (query.isError) toast.error(query.error.message, { id: "hardReboot" });
if (query.isError) toast.error(query.error.message, { id: "zoom" });
}, [query?.error?.message, query.isError]);
return { mutation, query };