при отсутствии QID в адресной строке выводится ошибка

This commit is contained in:
Tamara 2024-04-15 00:15:39 +03:00
parent 41326b5f04
commit 56be4ff736
3 changed files with 8 additions and 1 deletions

@ -76,6 +76,12 @@ export default function QuizAnswerer({ quizSettings, quizId, preview = false, ch
<ApologyPage error={new Error("No questions found")} />
</ThemeProvider>
);
if(!quizId) return (
<ThemeProvider theme={lightTheme}>
<ApologyPage error={error} />
</ThemeProvider>
);
return (
<QuizViewContext.Provider value={quizViewStore}>

@ -10,6 +10,7 @@ export const ApologyPage = ({ error }: Props) => {
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

@ -8,7 +8,7 @@ const defaultQuizId = "3c49550d-8c77-4788-bc2d-42586a261514"; //тест виз
// const defaultQuizId = "ad7f5a87-b833-4f5b-854e-453706ed655c"; // linear
export default function App() {
const quizId = useParams().quizId ?? defaultQuizId;
const quizId = useParams().quizId || "";
return (
<Box