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 { loginUser } from '~/lib/api/auth/login';
|
||||
import { loginSchema } from '~/lib/schemas/auth';
|
||||
|
||||
@@ -29,23 +28,21 @@ const form = useForm({
|
||||
validationSchema: toTypedSchema(loginSchema),
|
||||
});
|
||||
|
||||
const onSubmit = form.handleSubmit(
|
||||
async (values: z.output<typeof loginSchema>) => {
|
||||
if (loggingIn.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
loggingIn.value = true;
|
||||
|
||||
const { success } = await loginUser(values.email, values.password);
|
||||
|
||||
if (success) {
|
||||
await navigateTo({ path: '/' });
|
||||
}
|
||||
|
||||
loggingIn.value = false;
|
||||
const onSubmit = form.handleSubmit(async (values) => {
|
||||
if (loggingIn.value) {
|
||||
return;
|
||||
}
|
||||
);
|
||||
|
||||
loggingIn.value = true;
|
||||
|
||||
const { success } = await loginUser(values.email, values.password);
|
||||
|
||||
if (success) {
|
||||
await navigateTo({ path: '/' });
|
||||
}
|
||||
|
||||
loggingIn.value = false;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -86,8 +83,8 @@ const onSubmit = form.handleSubmit(
|
||||
autocomplete="off"
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
<FormMessage />
|
||||
</FormField>
|
||||
</form>
|
||||
</CardContent>
|
||||
|
||||
Reference in New Issue
Block a user