mirror of
https://github.com/danbulant/Portfolio
synced 2026-07-05 19:11:06 +00:00
feat: login error handling
This commit is contained in:
parent
33ed232749
commit
e6ad593da8
1 changed files with 13 additions and 4 deletions
|
|
@ -6,6 +6,7 @@
|
||||||
import { page } from '$app/stores';
|
import { page } from '$app/stores';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import { apiLogin } from '$lib/@api/candidate';
|
import { apiLogin } from '$lib/@api/candidate';
|
||||||
|
import { SvelteToast, toast } from '@zerodevx/svelte-toast'
|
||||||
|
|
||||||
let applicationId = Number($page.params.code);
|
let applicationId = Number($page.params.code);
|
||||||
let codeValueMobile: string = '';
|
let codeValueMobile: string = '';
|
||||||
|
|
@ -34,11 +35,12 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
codeValueMobile = codeValueArray.join('');
|
codeValueMobile = codeValueArray.join('');
|
||||||
|
|
||||||
|
if (codeValueArray.length === 12) {
|
||||||
|
submit();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$: if (codeValueArray.length === 12) {
|
|
||||||
submit();
|
|
||||||
}
|
|
||||||
|
|
||||||
const submit = async () => {
|
const submit = async () => {
|
||||||
try {
|
try {
|
||||||
|
|
@ -46,8 +48,14 @@
|
||||||
goto('/dashboard');
|
goto('/dashboard');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
toast.push('Neplatné heslo!', {
|
||||||
|
theme: {
|
||||||
|
'--toastColor': 'mintcream',
|
||||||
|
'--toastBackground': '#b91c1c',
|
||||||
|
'--toastBarBackground': '#7f1d1d'
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
// alert('ApplicationId: ' + applicationId + '; Password: ' + codeValueMobile);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onPaste = (e: ClipboardEvent) => {
|
const onPaste = (e: ClipboardEvent) => {
|
||||||
|
|
@ -77,6 +85,7 @@
|
||||||
<FullLayout>
|
<FullLayout>
|
||||||
<div class="modal">
|
<div class="modal">
|
||||||
<img class="mx-auto" src={woman} alt="" />
|
<img class="mx-auto" src={woman} alt="" />
|
||||||
|
<SvelteToast></SvelteToast>
|
||||||
<div class="flex items-center justify-center">
|
<div class="flex items-center justify-center">
|
||||||
<input bind:value={codeValueMobile} type="text" class="codeInputMobile" />
|
<input bind:value={codeValueMobile} type="text" class="codeInputMobile" />
|
||||||
{#each [1, 2, 3, 4] as value}
|
{#each [1, 2, 3, 4] as value}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue