show error when question count is 0
This commit is contained in:
parent
61ee7553e6
commit
dca1aaf4da
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user