mirror of
https://github.com/vercel/commerce.git
synced 2025-07-15 08:51:21 +00:00
Logout - deleted cookie
This commit is contained in:
parent
d906a0b3ac
commit
6ce96e8f0a
@ -1,5 +1,7 @@
|
|||||||
import { serialize } from 'cookie'
|
import { serialize } from 'cookie'
|
||||||
import type { LogoutEndpoint } from '.'
|
import type { LogoutEndpoint } from '.'
|
||||||
|
import {prepareSetCookie} from '../../../lib/prepareSetCookie';
|
||||||
|
import {setCookies} from '../../../lib/setCookie'
|
||||||
|
|
||||||
const logout: LogoutEndpoint['handlers']['logout'] = async ({
|
const logout: LogoutEndpoint['handlers']['logout'] = async ({
|
||||||
res,
|
res,
|
||||||
@ -7,10 +9,8 @@ const logout: LogoutEndpoint['handlers']['logout'] = async ({
|
|||||||
config,
|
config,
|
||||||
}) => {
|
}) => {
|
||||||
// Remove the cookie
|
// Remove the cookie
|
||||||
res.setHeader(
|
const authCookie = prepareSetCookie(config.customerCookie,'',{ maxAge: -1, path: '/' })
|
||||||
'Set-Cookie',
|
setCookies(res, [authCookie])
|
||||||
serialize(config.customerCookie, '', { maxAge: -1, path: '/' })
|
|
||||||
)
|
|
||||||
|
|
||||||
// Only allow redirects to a relative URL
|
// Only allow redirects to a relative URL
|
||||||
if (redirectTo?.startsWith('/')) {
|
if (redirectTo?.startsWith('/')) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user