added select form

This commit is contained in:
PxlLoewe
2025-02-21 22:51:10 +01:00
parent 30af30bd1d
commit 3fd0e991fd
13 changed files with 716 additions and 53 deletions

View File

@@ -2,7 +2,7 @@
import { zodResolver } from '@hookform/resolvers/zod';
import { signIn } from 'next-auth/react';
import Link from 'next/link';
import { useSearchParams } from 'next/navigation';
import { redirect, useSearchParams } from 'next/navigation';
import { useState } from 'react';
import { useForm } from 'react-hook-form';
import { Toaster, toast } from 'react-hot-toast';
@@ -29,10 +29,10 @@ export const Login = () => {
setIsLoading(true);
const data = await signIn('credentials', {
redirect: false,
callbackUrl: searchParams.get('redirect') || '/',
email: form.getValues('email'),
password: form.getValues('password'),
});
setIsLoading(false);
if (!data || data.error) {
toast.error('E-Mail / Passwort ist falsch!', {
style: {
@@ -42,8 +42,9 @@ export const Login = () => {
'var(--fallback-nc, oklch(var(--nc) / var(--tw-text-opacity, 1)))',
},
});
return;
}
setIsLoading(false);
redirect(searchParams.get('redirect') || '/');
})}
>
<div>