при отсутствии QID в адресной строке выводится ошибка
This commit is contained in:
parent
41326b5f04
commit
56be4ff736
@ -76,6 +76,12 @@ export default function QuizAnswerer({ quizSettings, quizId, preview = false, ch
|
|||||||
<ApologyPage error={new Error("No questions found")} />
|
<ApologyPage error={new Error("No questions found")} />
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
);
|
);
|
||||||
|
if(!quizId) return (
|
||||||
|
<ThemeProvider theme={lightTheme}>
|
||||||
|
<ApologyPage error={error} />
|
||||||
|
</ThemeProvider>
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<QuizViewContext.Provider value={quizViewStore}>
|
<QuizViewContext.Provider value={quizViewStore}>
|
||||||
|
@ -10,6 +10,7 @@ export const ApologyPage = ({ error }: Props) => {
|
|||||||
if (error.message === "No questions found") message = "Нет созданных вопросов";
|
if (error.message === "No questions found") message = "Нет созданных вопросов";
|
||||||
if (error.message === "Quiz already completed") message = "Вы уже прошли этот опрос";
|
if (error.message === "Quiz already completed") message = "Вы уже прошли этот опрос";
|
||||||
if (error.message === "No questions found") message = "Вопросы отсутствуют";
|
if (error.message === "No questions found") message = "Вопросы отсутствуют";
|
||||||
|
if (error.response?.data === "Invalid request data") message = "Такого квиза не существует";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
|
@ -8,7 +8,7 @@ const defaultQuizId = "3c49550d-8c77-4788-bc2d-42586a261514"; //тест виз
|
|||||||
// const defaultQuizId = "ad7f5a87-b833-4f5b-854e-453706ed655c"; // linear
|
// const defaultQuizId = "ad7f5a87-b833-4f5b-854e-453706ed655c"; // linear
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
const quizId = useParams().quizId ?? defaultQuizId;
|
const quizId = useParams().quizId || "";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
|
Loading…
Reference in New Issue
Block a user