feat: add environment configuration and implement cookie handling for user authentication
This commit is contained in:
@@ -1,10 +1,20 @@
|
||||
import { USER_COOKIES } from '~/configs/storages'
|
||||
import { ADMIN_COOKIES, USER_COOKIES } from '~/configs/cookies'
|
||||
|
||||
export const setUserLogoutHeaders = () => {
|
||||
const responseHeaders = new Headers()
|
||||
responseHeaders.append(
|
||||
'Set-Cookie',
|
||||
`${USER_COOKIES.token}=; Path=/news; Max-Age=0`,
|
||||
`${USER_COOKIES.token}=; Path=/news; HttpOnly; SameSite=Strict; Max-Age=0`,
|
||||
)
|
||||
|
||||
return responseHeaders
|
||||
}
|
||||
|
||||
export const setAdminLogoutHeaders = () => {
|
||||
const responseHeaders = new Headers()
|
||||
responseHeaders.append(
|
||||
'Set-Cookie',
|
||||
`${ADMIN_COOKIES.token}=; Path=/admin; HttpOnly; SameSite=Strict; Max-Age=0`,
|
||||
)
|
||||
|
||||
return responseHeaders
|
||||
|
||||
Reference in New Issue
Block a user