feat: Client side validation for Signup and Login
This commit is contained in:
parent
d61625771e
commit
5782831ea6
@ -4,9 +4,13 @@
|
|||||||
import { Input } from '$lib/components/ui/input/index.js';
|
import { Input } from '$lib/components/ui/input/index.js';
|
||||||
import { Label } from '$lib/components/ui/label/index.js';
|
import { Label } from '$lib/components/ui/label/index.js';
|
||||||
import { superForm } from 'sveltekit-superforms';
|
import { superForm } from 'sveltekit-superforms';
|
||||||
|
import { zodClient } from 'sveltekit-superforms/adapters';
|
||||||
|
import { loginSchema } from '$lib/types/login';
|
||||||
|
|
||||||
let { data } = $props();
|
let { data } = $props();
|
||||||
const { form, errors, message, enhance } = superForm(data.form);
|
const { form, errors, message, enhance } = superForm(data.form, {
|
||||||
|
validators: zodClient(loginSchema),
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
|
@ -4,9 +4,13 @@
|
|||||||
import { Input } from '$lib/components/ui/input/index.js';
|
import { Input } from '$lib/components/ui/input/index.js';
|
||||||
import { Label } from '$lib/components/ui/label/index.js';
|
import { Label } from '$lib/components/ui/label/index.js';
|
||||||
import { superForm } from 'sveltekit-superforms';
|
import { superForm } from 'sveltekit-superforms';
|
||||||
|
import { zodClient } from 'sveltekit-superforms/adapters';
|
||||||
|
import { signupSchema } from '$lib/types/signup.js';
|
||||||
|
|
||||||
let { data } = $props();
|
let { data } = $props();
|
||||||
const { form, errors, message, enhance } = superForm(data.form);
|
const { form, errors, message, enhance } = superForm(data.form, {
|
||||||
|
validators: zodClient(signupSchema),
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
|
Loading…
Reference in New Issue
Block a user