Обработка ошибки, когда вопросы для аудитории ещё не созданы
This commit is contained in:
parent
c186a04fa5
commit
770966ab4f
@ -93,7 +93,9 @@ export async function getData({ quizId }: { quizId: string }): Promise<{
|
||||
if (paudParam) body.auditory = Number(paudParam);
|
||||
|
||||
try {
|
||||
const { data, headers } = await axios<GetQuizDataResponse>(domain + `/answer/v1.0.0/settings`, {
|
||||
const { data, headers } = await axios<GetQuizDataResponse>(
|
||||
domain + `/answer/v1.0.0/settings${window.location.search}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"X-Sessionkey": SESSIONS,
|
||||
@ -104,7 +106,8 @@ export async function getData({ quizId }: { quizId: string }): Promise<{
|
||||
Browser: userAgent,
|
||||
},
|
||||
data: body,
|
||||
});
|
||||
}
|
||||
);
|
||||
const sessions = JSON.parse(localStorage.getItem("sessions") || "{}");
|
||||
|
||||
//Тут ещё проверка на антифрод без парса конфига. Нам не интересно время если не нужно запрещать проходить чаще чем в сутки
|
||||
@ -133,7 +136,9 @@ export async function getDataSingle({ quizId, page }: { quizId: string; page?: n
|
||||
try {
|
||||
// Первый запрос: 1 вопрос + конфиг
|
||||
if (isFirstRequest) {
|
||||
const { data, headers } = await axios<GetQuizDataResponse>(domain + `/answer/v1.0.0/settings`, {
|
||||
const { data, headers } = await axios<GetQuizDataResponse>(
|
||||
domain + `/answer/v1.0.0/settings${window.location.search}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"X-Sessionkey": SESSIONS,
|
||||
@ -149,7 +154,8 @@ export async function getDataSingle({ quizId, page }: { quizId: string; page?: n
|
||||
page: 0,
|
||||
need_config: true,
|
||||
},
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
globalStatus = data.settings.status;
|
||||
isFirstRequest = false;
|
||||
@ -165,7 +171,9 @@ export async function getDataSingle({ quizId, page }: { quizId: string; page?: n
|
||||
|
||||
// Если статус не AI - сразу делаем запрос за всеми вопросами
|
||||
if (globalStatus !== "ai") {
|
||||
const secondResponse = await axios<GetQuizDataResponse>(domain + `/answer/v1.0.0/settings`, {
|
||||
const secondResponse = await axios<GetQuizDataResponse>(
|
||||
domain + `/answer/v1.0.0/settings${window.location.search}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"X-Sessionkey": SESSIONS,
|
||||
@ -181,7 +189,8 @@ export async function getDataSingle({ quizId, page }: { quizId: string; page?: n
|
||||
page: 0,
|
||||
need_config: false,
|
||||
},
|
||||
});
|
||||
}
|
||||
);
|
||||
return {
|
||||
data: { ...data, items: secondResponse.data.items },
|
||||
isRecentlyCompleted: false,
|
||||
@ -192,7 +201,7 @@ export async function getDataSingle({ quizId, page }: { quizId: string; page?: n
|
||||
}
|
||||
|
||||
// Последующие запросы
|
||||
const response = await axios<GetQuizDataResponse>(domain + `/answer/v1.0.0/settings`, {
|
||||
const response = await axios<GetQuizDataResponse>(domain + `/answer/v1.0.0/settings${window.location.search}`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"X-Sessionkey": SESSIONS,
|
||||
|
@ -53,5 +53,6 @@
|
||||
"and": "and",
|
||||
"Get results": "Get results",
|
||||
"Data sent successfully": "Data sent successfully",
|
||||
"Step": "Step"
|
||||
"Step": "Step",
|
||||
"questions are not ready yet": "There are no questions for the audience yet. Please wait"
|
||||
}
|
||||
|
@ -53,5 +53,6 @@
|
||||
"and": "и",
|
||||
"Get results": "Получить результаты",
|
||||
"Data sent successfully": "Данные успешно отправлены",
|
||||
"Step": "Шаг"
|
||||
"Step": "Шаг",
|
||||
"questions are not ready yet": "Вопросы для аудитории ещё не созданы. Пожалуйста, подождите"
|
||||
}
|
||||
|
@ -53,5 +53,6 @@
|
||||
"and": "va",
|
||||
"Get results": "Natijalarni olish",
|
||||
"Data sent successfully": "Ma'lumotlar muvaffaqiyatli yuborildi",
|
||||
"Step": "Qadam"
|
||||
"Step": "Qadam",
|
||||
"questions are not ready yet": "Tomoshabinlar uchun hozircha savollar yo'q. Iltimos kuting"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user