added save and load endpoints

This commit is contained in:
2025-11-17 10:19:44 +00:00
parent 5ce70ffa06
commit d2f030f221
10 changed files with 52 additions and 11 deletions

View File

@@ -25,7 +25,7 @@ const SightingModal = ({ isSightingModalOpen, handleClose, sighting, onDelete }:
const { query, mutation } = useCameraBlackboard();
const hotlistNames = getHotlistName(sighting?.metadata?.hotlistMatches);
const handleAcknowledgeButton = () => {
const handleAcknowledgeButton = async () => {
try {
if (!sighting) {
toast.error("Cannot add sighting to alert list");
@@ -33,17 +33,27 @@ const SightingModal = ({ isSightingModalOpen, handleClose, sighting, onDelete }:
return;
}
if (!query.data.alertHistory) {
mutation.mutate({
await mutation.mutateAsync({
operation: "INSERT",
path: "alertHistory",
value: [sighting],
});
await mutation.mutateAsync({
operation: "SAVE",
path: "",
value: null,
});
} else {
mutation.mutate({
await mutation.mutateAsync({
operation: "APPEND",
path: "alertHistory",
value: sighting,
});
await mutation.mutateAsync({
operation: "SAVE",
path: "",
value: null,
});
toast.success("Sighting Successfully added to alert list");
}