show error when question count is 0

This commit is contained in:
nflnkr 2024-04-12 15:22:51 +03:00
parent 61ee7553e6
commit dca1aaf4da
2 changed files with 7 additions and 0 deletions

@ -71,6 +71,12 @@ export default function QuizAnswerer({ quizSettings, quizId, preview = false, ch
quizSettings ??= data;
if (!quizSettings) throw new Error("Quiz data is null");
if (quizSettings.questions.length === 0) return (
<ThemeProvider theme={lightTheme}>
<ApologyPage error={new Error("No questions found")} />
</ThemeProvider>
);
return (
<QuizViewContext.Provider value={quizViewStore}>
<RootContainerWidthContext.Provider value={rootContainerWidth}>

@ -9,6 +9,7 @@ export const ApologyPage = ({ error }: Props) => {
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 = "Вопросы отсутствуют";
return (
<Box