mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-26 13:48:59 +03:00
wip
This commit is contained in:
@@ -34,8 +34,8 @@ export default function Event({ eventId }) {
|
||||
debugger;
|
||||
const response = await fetch(`${apiHost}/api/events/${eventId}`, { method: 'DELETE' });
|
||||
debugger;
|
||||
const deleteEvent = await response.json();
|
||||
|
||||
const deleteEvent = await getJSON(response)
|
||||
debugger;
|
||||
success = deleteEvent.success;
|
||||
debugger;
|
||||
setDeleteStatus(success ? FetchStatus.LOADED : FetchStatus.ERROR);
|
||||
@@ -44,6 +44,11 @@ export default function Event({ eventId }) {
|
||||
setDeleteStatus(FetchStatus.ERROR);
|
||||
}
|
||||
|
||||
async function getJSON(response) {
|
||||
if (response.status === 204) return {success: true};
|
||||
return response.json();
|
||||
}
|
||||
|
||||
if (success) {
|
||||
setDeleteStatus(FetchStatus.LOADED);
|
||||
setShowDialog(false);
|
||||
|
||||
Reference in New Issue
Block a user