frontAnswerer/lib/ui_kit/ErrorBoundaryFallback.tsx

28 lines
831 B
TypeScript
Raw Normal View History

import { Box, Typography } from "@mui/material";
import { FallbackProps } from "react-error-boundary";
export default function ErrorBoundaryFallback({ error }: FallbackProps) {
let message = "Что-то пошло не так";
if (error.message === "No questions found") message = "Нет созданных вопросов";
if (error.message === "Quiz already completed") message = "Вы уже прошли этот опрос";
return (
<Box
sx={{
display: "flex",
alignItems: "center",
justifyContent: "center",
height: "100%",
}}
>
<Typography
sx={{
textAlign: "center",
}}
>{message}</Typography>
</Box>
);
}