edit users

This commit is contained in:
2025-07-21 09:37:53 +02:00
parent 6e0880eb3d
commit 50e066f794
46 changed files with 1284 additions and 232 deletions

View File

@@ -7,9 +7,8 @@ import {
CardContent,
CardFooter,
} from '@/components/ui/card';
import { toTypedSchema } from '@vee-validate/zod';
import { toTypedSchema } from '@vee-validate/yup';
import { useForm } from 'vee-validate';
import type z from 'zod';
import { registerUser } from '~/lib/api/auth/register';
import { registerSchema } from '~/lib/schemas/auth';
@@ -27,24 +26,22 @@ const form = useForm({
validationSchema: toTypedSchema(registerSchema),
});
const onSubmit = form.handleSubmit(
async (values: z.output<typeof registerSchema>) => {
registering.value = true;
const onSubmit = form.handleSubmit(async (values) => {
registering.value = true;
const { success } = await registerUser(
values.name,
values.email,
values.password
);
const { success } = await registerUser(
values.name,
values.email,
values.password
);
if (success) {
await navigateTo({ path: '/login' });
return;
}
registering.value = false;
if (success) {
await navigateTo({ path: '/login' });
return;
}
);
registering.value = false;
});
</script>
<template>
@@ -71,8 +68,8 @@ const onSubmit = form.handleSubmit(
autocomplete="off"
/>
</FormControl>
<FormMessage />
</FormItem>
<FormMessage />
</FormField>
<FormField v-slot="{ componentField }" name="email">
@@ -102,8 +99,8 @@ const onSubmit = form.handleSubmit(
autocomplete="off"
/>
</FormControl>
<FormMessage />
</FormItem>
<FormMessage />
</FormField>
</form>
</CardContent>