feat: update cookie paths for staff authentication and implement redirect logic in admin login

This commit is contained in:
Ardeman
2025-03-03 17:48:24 +08:00
parent 599a92fba3
commit 5007b8d4db
3 changed files with 15 additions and 2 deletions
+1 -1
View File
@@ -15,5 +15,5 @@ export const staffTokenCookieConfig = createCookie(STAFF_COOKIES.token, {
sameSite: 'lax',
secure: process.env.NODE_ENV === 'production',
secrets: [process.env.VITE_SALT_KEY || 'default-secret'],
path: '/lg-admin',
path: '/',
})
+1 -1
View File
@@ -14,7 +14,7 @@ export const setStaffLogoutHeaders = () => {
const responseHeaders = new Headers()
responseHeaders.append(
'Set-Cookie',
`${STAFF_COOKIES.token}=; Path=/lg-admin; HttpOnly; SameSite=Strict; Max-Age=0`,
`${STAFF_COOKIES.token}=; Path=/; HttpOnly; SameSite=Strict; Max-Age=0`,
)
return responseHeaders