From 6ce96e8f0a58b981524081845ed0fb095aeb5273 Mon Sep 17 00:00:00 2001 From: SushantJadhav Date: Thu, 26 Aug 2021 16:21:47 +0530 Subject: [PATCH] Logout - deleted cookie --- framework/kibocommerce/api/endpoints/logout/logout.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/framework/kibocommerce/api/endpoints/logout/logout.ts b/framework/kibocommerce/api/endpoints/logout/logout.ts index b90a8c3ce..0e8db26b8 100644 --- a/framework/kibocommerce/api/endpoints/logout/logout.ts +++ b/framework/kibocommerce/api/endpoints/logout/logout.ts @@ -1,5 +1,7 @@ import { serialize } from 'cookie' import type { LogoutEndpoint } from '.' +import {prepareSetCookie} from '../../../lib/prepareSetCookie'; +import {setCookies} from '../../../lib/setCookie' const logout: LogoutEndpoint['handlers']['logout'] = async ({ res, @@ -7,10 +9,8 @@ const logout: LogoutEndpoint['handlers']['logout'] = async ({ config, }) => { // Remove the cookie - res.setHeader( - 'Set-Cookie', - serialize(config.customerCookie, '', { maxAge: -1, path: '/' }) - ) + const authCookie = prepareSetCookie(config.customerCookie,'',{ maxAge: -1, path: '/' }) + setCookies(res, [authCookie]) // Only allow redirects to a relative URL if (redirectTo?.startsWith('/')) {