Update web/src/routes/Event.jsx

Co-authored-by: Paul Armstrong <paularmstrong@users.noreply.github.com>
This commit is contained in:
Mitch Ross 2021-04-15 11:52:33 -04:00
parent 35071a4c5f
commit 3b44a0bfe1

View File

@ -32,8 +32,7 @@ export default function Event({ eventId }) {
let success; let success;
try { try {
const response = await fetch(`${apiHost}/api/events/${eventId}`, { method: 'DELETE' }); const response = await fetch(`${apiHost}/api/events/${eventId}`, { method: 'DELETE' });
const deleteEvent = await getJSON(response) const { success = false, message } = await getJSON(response)
success = deleteEvent.success;
setDeleteStatus(success ? FetchStatus.LOADED : FetchStatus.ERROR); setDeleteStatus(success ? FetchStatus.LOADED : FetchStatus.ERROR);
setDeleteMessage(deleteEvent.message); setDeleteMessage(deleteEvent.message);
} catch (e) { } catch (e) {