diff --git a/lib/api/quizRelase.ts b/lib/api/quizRelase.ts index 4312d11..92ce9dd 100644 --- a/lib/api/quizRelase.ts +++ b/lib/api/quizRelase.ts @@ -57,6 +57,9 @@ type PublicationMakeRequestParams = { method: "POST"; }; +const urlParams = new URLSearchParams(window.location.search); +const paudParam = urlParams.get("_paud"); + export const publicationMakeRequest = ({ url, body }: PublicationMakeRequestParams) => { return axios(url, { data: body, @@ -75,11 +78,20 @@ export const publicationMakeRequest = ({ url, body }: PublicationMakeRequestPara // Глобальные переменные для хранения состояния между вызовами let globalStatus: string | null = null; let isFirstRequest = true; + export async function getData({ quizId }: { quizId: string }): Promise<{ data: GetQuizDataResponse | null; isRecentlyCompleted: boolean; error?: AxiosError; }> { + const body = { + quiz_id: quizId, + limit: 100, + page: 0, + need_config: true, + } as any; + if (paudParam) body.auditory = Number(paudParam); + try { const { data, headers } = await axios( domain + `/answer/v1.0.0/settings${window.location.search}`, @@ -93,12 +105,7 @@ export async function getData({ quizId }: { quizId: string }): Promise<{ OS: OSDevice, Browser: userAgent, }, - data: { - quiz_id: quizId, - limit: 100, - page: 0, - need_config: true, - }, + data: body, } ); const sessions = JSON.parse(localStorage.getItem("sessions") || "{}"); @@ -120,6 +127,7 @@ export async function getData({ quizId }: { quizId: string }): Promise<{ return { data: null, isRecentlyCompleted: false, error: error }; } } + export async function getDataSingle({ quizId, page }: { quizId: string; page?: number }): Promise<{ data: GetQuizDataResponse | null; isRecentlyCompleted: boolean; diff --git a/lib/components/ViewPublicationPage/ContactForm/ContactForm.tsx b/lib/components/ViewPublicationPage/ContactForm/ContactForm.tsx index 21bee90..dfd7f6d 100644 --- a/lib/components/ViewPublicationPage/ContactForm/ContactForm.tsx +++ b/lib/components/ViewPublicationPage/ContactForm/ContactForm.tsx @@ -167,6 +167,7 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => { if (settings.cfg.resultInfo.showResultForm === "after") { onShowResult(); } + enqueueSnackbar(t("Data sent successfully")); } setFire(false); diff --git a/package.json b/package.json index 8d60a60..b81b648 100755 --- a/package.json +++ b/package.json @@ -119,5 +119,6 @@ }, "lint-staged": { "*": "prettier --write --ignore-unknown" - } + }, + "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" } diff --git a/public/locales/en.json b/public/locales/en.json index 3d15931..8390ebc 100644 --- a/public/locales/en.json +++ b/public/locales/en.json @@ -52,7 +52,7 @@ "familiarized": "acknowledged", "and": "and", "Get results": "Get results", + "Data sent successfully": "Data sent successfully", "Step": "Step", - "D": "-_-", - "d": "-_-" + "questions are not ready yet": "There are no questions for the audience yet. Please wait" } diff --git a/public/locales/ru.json b/public/locales/ru.json index 25ee072..73274ce 100644 --- a/public/locales/ru.json +++ b/public/locales/ru.json @@ -55,5 +55,6 @@ "Data sent successfully": "Данные успешно отправлены", "Step": "Шаг", "neftyanka FK": "Заполните форму, чтобы отправить ваши ответы на викторину", - "neftyanka button": "Отправить" + "neftyanka button": "Отправить", + "questions are not ready yet": "Вопросы для аудитории ещё не созданы. Пожалуйста, подождите" } diff --git a/public/locales/uz.json b/public/locales/uz.json index 5ee2b01..c7d79a5 100644 --- a/public/locales/uz.json +++ b/public/locales/uz.json @@ -52,7 +52,7 @@ "familiarized": "tanishdim", "and": "va", "Get results": "Natijalarni olish", + "Data sent successfully": "Ma'lumotlar muvaffaqiyatli yuborildi", "Step": "Qadam", - "D": "-_-", - "d": "-_-" + "questions are not ready yet": "Tomoshabinlar uchun hozircha savollar yo'q. Iltimos kuting" }