Done!

This commit is contained in:
Mawoka
2022-10-04 20:04:08 +02:00
parent d52f8cc017
commit 6d0b88b56a
6 changed files with 65 additions and 17 deletions
+6 -3
View File
@@ -14,26 +14,26 @@
let captcha_selected = false;
let selected_game_mode = 'kahoot';
let loading = false;
let custom_field = '';
const start_game = async (id: string) => {
let res;
loading = true;
if (captcha_enabled && captcha_selected) {
res = await fetch(
`/api/v1/quiz/start/${id}?captcha_enabled=True&game_mode=${selected_game_mode}`,
`/api/v1/quiz/start/${id}?captcha_enabled=True&game_mode=${selected_game_mode}&custom_field=${custom_field}`,
{
method: 'POST'
}
);
} else {
res = await fetch(
`/api/v1/quiz/start/${id}?captcha_enabled=False&game_mode=${selected_game_mode}`,
`/api/v1/quiz/start/${id}?captcha_enabled=False&game_mode=${selected_game_mode}&custom_field=${custom_field}`,
{
method: 'POST'
}
);
}
if (res.status !== 200) {
alertModal.set({
open: true,
@@ -111,6 +111,9 @@
</p>
</div>
</div>
<div class="flex justify-center">
<input bind:value={custom_field} />
</div>
<button
class="mt-auto mx-auto bg-green-500 p-4 rounded-lg shadow-lg hover:bg-green-400 transition-all marck-script text-2xl"