diff --git a/web/src/routes/Event.jsx b/web/src/routes/Event.jsx
index cf45f9e62..6640f0dbd 100644
--- a/web/src/routes/Event.jsx
+++ b/web/src/routes/Event.jsx
@@ -1,5 +1,10 @@
import { h, Fragment } from 'preact';
+import { useCallback, useState } from 'preact/hooks';
+import { route } from 'preact-router';
import ActivityIndicator from '../components/ActivityIndicator';
+import Button from '../components/Button';
+import Delete from '../icons/Delete'
+import Dialog from '../components/Dialog';
import Heading from '../components/Heading';
import Link from '../components/Link';
import { FetchStatus, useApiHost, useEvent } from '../api';
@@ -8,6 +13,23 @@ import { Table, Thead, Tbody, Th, Tr, Td } from '../components/Table';
export default function Event({ eventId }) {
const apiHost = useApiHost();
const { data, status } = useEvent(eventId);
+ const [showDialog, setShowDialog] = useState(false);
+
+ const handleClickDelete = () => {
+ setShowDialog(true);
+ }
+
+ const handleDismissDeleteDialog = () => {
+ setShowDialog(false);
+ };
+
+ const handleClickDeleteDialog = useCallback(
+ async () => {
+ await fetch(`${apiHost}/api/events/${eventId}`, {method: 'DELETE'});
+ setShowDialog(false);
+ route('/events', true);
+ }, [apiHost, eventId, setShowDialog]
+ );
if (status !== FetchStatus.LOADED) {
return
| Date | Start | End | -@@ -194,11 +179,6 @@ export default function Events({ path: pathname, limit = API_LIMIT } = {}) { | {start.toLocaleDateString()} | {start.toLocaleTimeString()} | {end.toLocaleTimeString()} | -- - | ); } @@ -206,7 +186,7 @@ export default function Events({ path: pathname, limit = API_LIMIT } = {}) {|||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| + |
{status === FetchStatus.LOADING ? |
|||||||||||||||