Merge branch 'dev' into 'staging'
Dev See merge request frontend/squzanswerer!102
This commit is contained in:
commit
55d10b7045
@ -55,7 +55,7 @@ export const publicationMakeRequest = ({ url, body }: any) => {
|
||||
export async function getData(quizId: string): Promise<{
|
||||
data: GetQuizDataResponse | null;
|
||||
isRecentlyCompleted: boolean;
|
||||
error?: string;
|
||||
error?: any;
|
||||
}> {
|
||||
try {
|
||||
const { data, headers } = await axios<GetQuizDataResponse>(
|
||||
@ -93,7 +93,7 @@ export async function getData(quizId: string): Promise<{
|
||||
} catch (nativeError) {
|
||||
const error = nativeError as AxiosError;
|
||||
|
||||
return { data: null, isRecentlyCompleted: false, error: error.message };
|
||||
return { data: null, isRecentlyCompleted: false, error: error };
|
||||
}
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ export async function getQuizData(quizId: string) {
|
||||
const quizDataResponse = response.data;
|
||||
|
||||
if (response.error) {
|
||||
throw new Error(response.error);
|
||||
throw response.error;
|
||||
}
|
||||
if (!quizDataResponse) {
|
||||
throw new Error("Quiz not found");
|
||||
|
@ -57,8 +57,16 @@ export default function QuizAnswerer({ quizSettings, quizId, preview = false, ch
|
||||
};
|
||||
}, []);
|
||||
|
||||
if (isLoading) return <LoadingSkeleton />;
|
||||
if (error) return <ApologyPage error={error} />;
|
||||
if (isLoading) return (
|
||||
<ThemeProvider theme={lightTheme}>
|
||||
<LoadingSkeleton />
|
||||
</ThemeProvider>
|
||||
);
|
||||
if (error) return (
|
||||
<ThemeProvider theme={lightTheme}>
|
||||
<ApologyPage error={error} />
|
||||
</ThemeProvider>
|
||||
);
|
||||
|
||||
quizSettings ??= data;
|
||||
if (!quizSettings) throw new Error("Quiz data is null");
|
||||
|
@ -5,7 +5,8 @@ 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 = "Вы уже прошли этот опрос";
|
||||
|
||||
|
@ -73,9 +73,8 @@ export const Question = ({
|
||||
>
|
||||
<Box
|
||||
sx={{
|
||||
position: "relative",
|
||||
height: "100%",
|
||||
width: "100%",
|
||||
minHeight: "100%",
|
||||
maxWidth: "1440px",
|
||||
padding: "40px 25px 20px",
|
||||
margin: "0 auto",
|
||||
@ -94,9 +93,8 @@ export const Question = ({
|
||||
target="_blank"
|
||||
href="https://quiz.pena.digital"
|
||||
sx={{
|
||||
position: "absolute",
|
||||
bottom: "20px",
|
||||
right: "25px",
|
||||
mt: "20px",
|
||||
alignSelf: "end",
|
||||
}}
|
||||
>
|
||||
{quizThemes[settings.cfg.theme].isLight ? (
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@frontend/squzanswerer",
|
||||
"version": "1.0.19",
|
||||
"version": "1.0.21",
|
||||
"type": "module",
|
||||
"main": "./dist-package/index.js",
|
||||
"module": "./dist-package/index.js",
|
||||
|
Loading…
Reference in New Issue
Block a user