mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-02 09:15:22 +03:00
Update to new arch
This commit is contained in:
parent
ce6d9b3ca9
commit
5d91fc34cd
@ -123,9 +123,19 @@ export function useRetain() {
|
|||||||
async function retainEvent(eventId, shouldRetain) {
|
async function retainEvent(eventId, shouldRetain) {
|
||||||
if (!eventId) return null;
|
if (!eventId) return null;
|
||||||
|
|
||||||
const response = await fetch(`${state.host}/api/events/${eventId}?retain=${shouldRetain}`, { method: 'POST' });
|
console.log("trying to set retain as " + shouldRetain);
|
||||||
await dispatch({ type: 'POST', payload: { eventId } });
|
|
||||||
return await (response.status < 300 ? response.json() : { success: true });
|
if (shouldRetain) {
|
||||||
|
const response = await fetch(`${state.host}/api/events/${eventId}/retain`, { method: 'POST' });
|
||||||
|
console.log("response is " + response.status);
|
||||||
|
await dispatch({ type: 'POST', payload: { eventId } });
|
||||||
|
return await (response.status < 300 ? response.json() : { success: true });
|
||||||
|
} else {
|
||||||
|
const response = await fetch(`${state.host}/api/events/${eventId}/retain`, { method: 'DELETE' });
|
||||||
|
console.log("response is " + response.status);
|
||||||
|
await dispatch({ type: 'DELETE', payload: { eventId } });
|
||||||
|
return await (response.status < 300 ? response.json() : { success: true });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return retainEvent;
|
return retainEvent;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user