✨ Closes #234
This commit is contained in:
@@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
if (browser) {
|
if (browser) {
|
||||||
|
prefetch_username();
|
||||||
hcaptcha = window.hcaptcha;
|
hcaptcha = window.hcaptcha;
|
||||||
if (hcaptcha.render) {
|
if (hcaptcha.render) {
|
||||||
hcaptchaWidgetID = hcaptcha.render('hcaptcha', {
|
hcaptchaWidgetID = hcaptcha.render('hcaptcha', {
|
||||||
@@ -54,6 +55,15 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const prefetch_username = async () => {
|
||||||
|
const res = await fetch('/api/v1/users/me');
|
||||||
|
if (res.status !== 200) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const json = await res.json();
|
||||||
|
username = json.username;
|
||||||
|
};
|
||||||
|
|
||||||
const set_game_pin = async () => {
|
const set_game_pin = async () => {
|
||||||
let process_var;
|
let process_var;
|
||||||
try {
|
try {
|
||||||
@@ -73,20 +83,20 @@
|
|||||||
}
|
}
|
||||||
if (res.status === 404) {
|
if (res.status === 404) {
|
||||||
/* alertModal.set({
|
/* alertModal.set({
|
||||||
open: true,
|
open: true,
|
||||||
title: 'Game not found',
|
title: 'Game not found',
|
||||||
body: 'The game pin you entered seems invalid.'
|
body: 'The game pin you entered seems invalid.'
|
||||||
});*/
|
});*/
|
||||||
alert('Game not found');
|
alert('Game not found');
|
||||||
game_pin = '';
|
game_pin = '';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (res.status !== 200) {
|
if (res.status !== 200) {
|
||||||
/* alertModal.set({
|
/* alertModal.set({
|
||||||
open: true,
|
open: true,
|
||||||
body: `Unknown error with response-code ${res.status}`,
|
body: `Unknown error with response-code ${res.status}`,
|
||||||
title: 'Unknown Error'
|
title: 'Unknown Error'
|
||||||
});*/
|
});*/
|
||||||
alert('Unknown error');
|
alert('Unknown error');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -125,10 +135,10 @@
|
|||||||
Sentry.captureException(e);
|
Sentry.captureException(e);
|
||||||
}
|
}
|
||||||
/* alertModal.set({
|
/* alertModal.set({
|
||||||
open: true,
|
open: true,
|
||||||
body: "The captcha failed, which is normal, but most of the time it's fixed by reloading!",
|
body: "The captcha failed, which is normal, but most of the time it's fixed by reloading!",
|
||||||
title: 'Captcha failed'
|
title: 'Captcha failed'
|
||||||
});*/
|
});*/
|
||||||
alert('Captcha failed!');
|
alert('Captcha failed!');
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user