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