Removed pow, alertModal and fixed storage

This commit is contained in:
Mawoka
2023-05-28 13:03:20 +02:00
parent 0a73c3a811
commit c0bb8ce599
14 changed files with 60 additions and 130 deletions
+3 -2
View File
@@ -91,7 +91,8 @@
{:else}
<slot />
{/if}
{#if $alertModal.open ?? false}
<!--{#if $alertModal.open ?? false}
<div
class="fixed inset-0 h-screen w-screen bg-black z-30 bg-opacity-60 items-center justify-center content-center"
class:hidden={!$alertModal.open}
@@ -104,7 +105,7 @@
bind:open={$alertModal.open}
/>
</div>
{/if}
{/if}-->
<style lang="scss">
:global(html:not(.dark)) {
@@ -37,19 +37,16 @@
try {
data = await res.json();
} catch {
alertModal.set({
open: true,
body: "This shouldn't happen. Please try again.",
title: 'Unknown error'
});
alert("This shouldn't happen");
window.location.reload();
}
if (data.detail === 'wrong credentials') {
alertModal.set({
/* alertModal.set({
open: true,
body: 'Please try again. Your email and or password were incorrect.',
title: 'Wrong Credentials'
});
});*/
alert('Wrong credentials');
}
}
};
@@ -44,19 +44,21 @@
try {
data = await res.json();
} catch {
alertModal.set({
/* alertModal.set({
open: true,
body: "This shouldn't happen. Please try again.",
title: 'Unknown error'
});
});*/
alert('Unknown error');
window.location.reload();
}
if (data.detail === 'totp wrong') {
alertModal.set({
/* alertModal.set({
open: true,
body: 'Wrong Totp-Code. please try again.',
title: 'Totp Error'
});
});*/
alert('TOTP code was incorrect');
totp = '';
}
}
@@ -24,11 +24,12 @@
asseResp = await startAuthentication(data);
} catch (e) {
console.error(e);
alertModal.set({
/* alertModal.set({
open: true,
body: e,
title: 'Unknown error'
});
});*/
alert('Unknown error');
isLoading = false;
}
const res = await fetch(
@@ -51,19 +52,21 @@
try {
data = await res.json();
} catch {
alertModal.set({
/* alertModal.set({
open: true,
body: "This shouldn't happen. Please try again.",
title: 'Unknown error'
});
});*/
alert('Unknown error');
window.location.reload();
}
if (data.detail === 'webauthn failed') {
alertModal.set({
/* alertModal.set({
open: true,
body: 'Webauthn failed. Please try again.',
title: 'Webauthn Error'
});
});*/
alert('Webauthn failed');
}
}
isLoading = false;
+9 -6
View File
@@ -35,17 +35,19 @@
if (res.status === 200) {
window.location.href = '/dashboard';
} else if (res.status === 400) {
alertModal.set({
/* alertModal.set({
open: true,
title: 'Import failed',
body: "This quiz isn't (yet) supported!"
});
});*/
alert("This quiz isn't (yet) supported!");
} else {
alertModal.set({
/* alertModal.set({
open: true,
title: 'Import failed',
body: 'Unknown error while importing the quiz!'
});
});*/
alert('Import failed with unknown reason');
}
is_loading = false;
};
@@ -61,11 +63,12 @@
if (res.status === 200) {
window.location.href = '/dashboard';
} else {
alertModal.set({
/* alertModal.set({
open: true,
title: 'Import failed',
body: 'Something went wrong!'
});
});*/
alert('Something went wrong!');
}
is_loading = false;
};