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;
try {
const response = await fetch(`${apiHost}/api/events/${eventId}`, { method: 'DELETE' });
const deleteEvent = await getJSON(response)
success = deleteEvent.success;
const { success = false, message } = await getJSON(response)
setDeleteStatus(success ? FetchStatus.LOADED : FetchStatus.ERROR);
setDeleteMessage(deleteEvent.message);
} catch (e) {