From 6f4d758e5cad378de88267e79597ed1d78b399b5 Mon Sep 17 00:00:00 2001 From: sepehr Date: Thu, 8 Jan 2026 21:35:55 +0100 Subject: [PATCH] Fix authentication and Prisma query issues --- keep-notes/app/actions/auth.ts | 10 +++++----- keep-notes/app/actions/notes.ts | 2 +- keep-notes/prisma/dev.db | Bin 2904064 -> 2904064 bytes 3 files changed, 6 insertions(+), 6 deletions(-) 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 431077977a9975d0a24ef0154f79ed564fe9a03b..b3d81c2f68cf65982346bfd27ca29dca65dc5d88 100644 GIT binary patch delta 1043 zcma*lUr19?90%}ooY!`@c7B=N%%(Lh)9S%3mna1Hp#&jDLAqa#(5fu#7hxU+&1=&L{Mt`6JLn^9=eCT`cGI1yb`y37&e!t)Mp0n-; zBfJ}W-F)y)@o_#la`9nR8PPbS75YWr=nH+K_q0f_X@Q>8ETw6Np3wMcskfIX*JkI| zBFvrZZdz3{wZG{neWfM(Nbj;MX>pUsl2Z#z>6gDZ;MXpWp$>EgvxMpX|k#)Kvk44zKd64 zLiCH2Xc8(q6^V0ZVRKvb=(SLLtKaMO`kEu&I)At};qwKf)&%SH(&g$JoK|;r`NH8) zXGd44BVi5AoYo}FQ=fSnJrefUMz6HFditk0NP9Ia zxV+kQqc{Ao;O@X`>K7{^7j8ybmwIi$27d!X@5BXk8rhj00}amEOy(Yc>L47N@TU&X GE&KuM8dzok delta 453 zcma*jy-Nad7zgmXwAVX--|WrG%d{7J8!Wi3Kq4BW{)1|6uvJ`clfWTy5T|Y^nu6p8 zH!r9gjIbdaS_~?vp@<4G|?~9v;KY%LZ-x