diff --git a/client/src/components/EventCard.css b/client/src/components/EventCard.css new file mode 100644 index 0000000..3e9d300 --- /dev/null +++ b/client/src/components/EventCard.css @@ -0,0 +1,3 @@ +.inactive { + color: rgb(196, 194, 194); +} diff --git a/client/src/components/EventCard.tsx b/client/src/components/EventCard.tsx index 95c6da7..ce28c6b 100644 --- a/client/src/components/EventCard.tsx +++ b/client/src/components/EventCard.tsx @@ -13,7 +13,6 @@ import { Snackbar, Switch, } from "@mui/material"; -import Grid from "@mui/material/Grid2"; import DeleteIcon from "@mui/icons-material/Delete"; import EditIcon from "@mui/icons-material/Edit"; @@ -21,6 +20,7 @@ import ShareIcon from "@mui/icons-material/Share"; import { EventDocument } from "../helpers/EventDocument"; import { useTranslation } from "react-i18next"; +import "./EventCard.css"; type EventCardProps = { @@ -58,12 +58,16 @@ export const EventCard = (props: EventCardProps) => { }; const handleDelete = () => { - deleteEvent(props.event._id).then((res) => { - if (res.data.success === false) { - signout(); + deleteEvent(props.event._id) + .then((res) => { + if (res.data.success === false) { + navigate("/landing"); + } + }) + .catch((res) => { + console.error("deleteEvent failed: %o", res); navigate("/landing"); - } - }); + }); if (props.onDelete) { props.onDelete(props.event); } @@ -71,53 +75,53 @@ export const EventCard = (props: EventCardProps) => { return ( <> - - - - - - } - title={props.event.name} - subheader={{props.event.duration} min} - /> - {props.event.description} - - - + + + - + - - - + } + title={props.event.name} + subheader={{props.event.duration} min} + /> + {props.event.description} + + + + + + + + + { return ( {list} diff --git a/client/src/components/PrivateRoute.tsx b/client/src/components/PrivateRoute.tsx index ef5cf7f..acf8cac 100644 --- a/client/src/components/PrivateRoute.tsx +++ b/client/src/components/PrivateRoute.tsx @@ -34,8 +34,8 @@ const PrivateRoute = ({ children }: { children: JSX.Element }) => { console.log("user set to %o", res.data); } }) - .catch(() => { - console.log("getUserById: error"); + .catch((res) => { + console.log("getUser: error: %d", res.status); setAuthenticated(false); navigate("/landing"); // TODO: Add SnackBar