edit users
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user