import ErrorOutlineIcon from "@mui/icons-material/ErrorOutline"; import ReplayIcon from "@mui/icons-material/Replay"; import { Box, Button, Fade, Paper, Stack, Typography } from "@mui/material"; import { useEffect } from "react"; import { push } from "redux-first-history"; import { useAppDispatch, useAppSelector } from "../../app/hooks"; export function Error() { const dispatch = useAppDispatch(); const userError = useAppSelector((state) => state.user.error); const calendarError = useAppSelector((state) => state.calendars.error); useEffect(() => { if (!userError) { dispatch(push("/")); } }, [calendarError, dispatch]); const errorMessage = userError || calendarError || "Unknown error"; return ( Something went wrong {errorMessage} ); }