33 lines
1.2 KiB
TypeScript
33 lines
1.2 KiB
TypeScript
import { Box, Typography } from "@mui/material";
|
|
import { FallbackProps } from "react-error-boundary";
|
|
|
|
type Props = Partial<FallbackProps>;
|
|
|
|
export const ApologyPage = ({ error }: Props) => {
|
|
let message = "Что-то пошло не так";
|
|
|
|
if (error.response?.data === "quiz is inactive") message = "Квиз не активирован";
|
|
if (error.message === "No questions found") message = "Нет созданных вопросов";
|
|
if (error.message === "Quiz already completed") message = "Вы уже прошли этот опрос";
|
|
if (error.message === "No questions found") message = "Вопросы отсутствуют";
|
|
if (error.response?.data === "Invalid request data") message = "Такого квиза не существует";
|
|
|
|
return (
|
|
<Box
|
|
sx={{
|
|
display: "flex",
|
|
alignItems: "center",
|
|
justifyContent: "center",
|
|
height: "100%",
|
|
}}
|
|
>
|
|
<Typography
|
|
sx={{
|
|
textAlign: "center",
|
|
color: "text.primary",
|
|
}}
|
|
>{message}</Typography>
|
|
</Box>
|
|
);
|
|
};
|