feat: error handling

This commit is contained in:
Sebastian Pravda 2023-01-11 23:45:10 +01:00 committed by EETagent
parent e6ad593da8
commit 0fd82c6c3e
3 changed files with 12 additions and 2 deletions

View file

@ -18,6 +18,7 @@
<style lang="postcss">
input {
@apply hover:cursor-pointer;
@apply bg-sspsBlue hover:bg-sspsBlueDark
@apply @apply rounded-lg p-3 text-xl font-semibold
text-white transition-colors duration-300;

View file

@ -14,6 +14,7 @@
import TelephoneField from '$lib/components/textfield/TelephoneField.svelte';
import TextField from '$lib/components/textfield/TextField.svelte';
import type { PageData } from './$types';
import { SvelteToast, toast } from '@zerodevx/svelte-toast';
import { createForm } from 'svelte-forms-lib';
import type { Writable } from 'svelte/store';
@ -199,7 +200,14 @@
values.candidate.birthdate
)
) {
alert('Rodné číslo neodpovídá oficiální specifikaci či datumu narození'); // TODO: alerts
// alert('Rodné číslo neodpovídá oficiální specifikaci či datumu narození'); // TODO: alerts
toast.push('Rodné číslo neodpovídá oficiální specifikaci či datumu narození', {
theme: {
'--toastColor': 'mintcream',
'--toastBackground': '#b91c1c',
'--toastBarBackground': '#7f1d1d'
}
})
throw new Error('Rodné číslo neodpovídá datumu narození');
}
}
@ -332,6 +340,7 @@
</script>
<SplitLayout>
<SvelteToast></SvelteToast>
<div class="form relative">
<div class="bottom-3/12 absolute flex w-full flex-col md:h-auto">
<div class="<md:h-24 <md:w-24 mb-4 h-32 w-32 self-center">

View file

@ -36,7 +36,7 @@
}
codeValueMobile = codeValueArray.join('');
if (codeValueArray.length === 12) {
if (codeValueArray.length == 12) {
submit();
}
};