Remove next-auth

This commit is contained in:
Delba de Oliveira
2024-06-05 09:29:15 +01:00
parent b7a4366f68
commit 57c9546532
6 changed files with 78 additions and 648 deletions

View File

@@ -4,8 +4,6 @@ import { z } from 'zod';
import { sql } from '@vercel/postgres';
import { revalidatePath } from 'next/cache';
import { redirect } from 'next/navigation';
import { signIn } from '@/auth';
import { AuthError } from 'next-auth';
const FormSchema = z.object({
id: z.string(),
@@ -124,17 +122,5 @@ export async function authenticate(
prevState: string | undefined,
formData: FormData,
) {
try {
await signIn('credentials', formData);
} catch (error) {
if (error instanceof AuthError) {
switch (error.type) {
case 'CredentialsSignin':
return 'Invalid credentials.';
default:
return 'Something went wrong.';
}
}
throw error;
}
return null
}