From 1203dca98a712d5c0fcb8af635beea68f9ec6559 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Tue, 21 Nov 2023 10:15:35 +0700
Subject: Add cookies credential expires

---
 src/app/api/auth/login/route.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/app/api/auth/login/route.tsx')

diff --git a/src/app/api/auth/login/route.tsx b/src/app/api/auth/login/route.tsx
index d4da662..29e7f6c 100644
--- a/src/app/api/auth/login/route.tsx
+++ b/src/app/api/auth/login/route.tsx
@@ -30,7 +30,7 @@ export async function POST(request: NextRequest) {
     token: jwt.sign(user, JWT_SECRET, { expiresIn: '10y' })
   }
 
-  cookies().set('credential', JSON.stringify(credential))
+  cookies().set('credential', JSON.stringify(credential), { secure: true, expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 30) })
 
   return NextResponse.json(credential)
 }
\ No newline at end of file
-- 
cgit v1.2.3

