From e8b5b3ab32077a3f5f54551506733b1f7e961d17 Mon Sep 17 00:00:00 2001 From: Eugenio Romano Date: Fri, 9 Oct 2020 15:55:32 +0100 Subject: [PATCH] fix delete cookie in path (#6236) [skip ci] --- lib/core/services/cookie.service.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/core/services/cookie.service.ts b/lib/core/services/cookie.service.ts index e37b03b722..18732eef54 100644 --- a/lib/core/services/cookie.service.ts +++ b/lib/core/services/cookie.service.ts @@ -70,9 +70,11 @@ export class CookieService { /** * Delete a cookie Key. * @param key Key to identify the cookie + * @param path "Pathname" to store the cookie */ - deleteCookie(key: string): void { - document.cookie = key + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;'; + deleteCookie(key: string, path: string | null = null): void { + document.cookie = key + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;' + + (path ? `;path=${path}` : ';path=/'); } /** Placeholder for testing purposes - do not use. */