diff --git a/keep-notes/app/actions/auth.ts b/keep-notes/app/actions/auth.ts index a1e7c3b..58f6700 100644 --- a/keep-notes/app/actions/auth.ts +++ b/keep-notes/app/actions/auth.ts @@ -8,7 +8,11 @@ export async function authenticate( formData: FormData, ) { try { - await signIn('credentials', formData); + await signIn('credentials', { + email: formData.get('email'), + password: formData.get('password'), + redirectTo: '/', + }); } catch (error) { if (error instanceof AuthError) { console.error('AuthError details:', error.type, error.message); @@ -20,10 +24,6 @@ export async function authenticate( } } // IMPORTANT: Next.js redirects throw a special error that must be rethrown - if (error instanceof Error && error.message === 'NEXT_REDIRECT') { - throw error; - } - console.error('Non-AuthError during signin:', error); throw error; } } diff --git a/keep-notes/app/actions/notes.ts b/keep-notes/app/actions/notes.ts index 063d051..9c3fe45 100644 --- a/keep-notes/app/actions/notes.ts +++ b/keep-notes/app/actions/notes.ts @@ -25,7 +25,7 @@ export async function getNotes(includeArchived = false) { const notes = await prisma.note.findMany({ where: { userId: session.user.id, - isArchived: includeArchived ? {} : { isArchived: false }, + ...(includeArchived ? {} : { isArchived: false }), }, orderBy: [ { isPinned: 'desc' }, diff --git a/keep-notes/prisma/dev.db b/keep-notes/prisma/dev.db index 4310779..b3d81c2 100644 Binary files a/keep-notes/prisma/dev.db and b/keep-notes/prisma/dev.db differ