mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-13 06:35:24 +03:00
Handle frigate+ error
This commit is contained in:
parent
a87a9fbbf9
commit
39261c208c
@ -13,6 +13,7 @@ import { FrigateConfig } from "@/types/frigateConfig";
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { useCallback, useMemo } from "react";
|
import { useCallback, useMemo } from "react";
|
||||||
import { TransformWrapper, TransformComponent } from "react-zoom-pan-pinch";
|
import { TransformWrapper, TransformComponent } from "react-zoom-pan-pinch";
|
||||||
|
import { toast } from "sonner";
|
||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
|
|
||||||
type FrigatePlusDialogProps = {
|
type FrigatePlusDialogProps = {
|
||||||
@ -55,14 +56,24 @@ export function FrigatePlusDialog({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
falsePositive
|
const req = falsePositive
|
||||||
? axios.put(`events/${upload.id}/false_positive`)
|
? axios.put(`events/${upload.id}/false_positive`)
|
||||||
: axios.post(`events/${upload.id}/plus`, {
|
: axios.post(`events/${upload.id}/plus`, {
|
||||||
include_annotation: 1,
|
include_annotation: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
onEventUploaded();
|
req
|
||||||
onClose();
|
.then((resp) => {
|
||||||
|
if (resp.status == 200) {
|
||||||
|
onEventUploaded();
|
||||||
|
onClose();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
toast.error("Failed to upload image.", {
|
||||||
|
position: "top-center",
|
||||||
|
});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
[upload, onClose, onEventUploaded],
|
[upload, onClose, onEventUploaded],
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user