fix delete cookie in path (#6236)

[skip ci]
This commit is contained in:
Eugenio Romano
2020-10-09 15:55:32 +01:00
committed by GitHub
parent edb9fc5f2b
commit e8b5b3ab32

View File

@@ -70,9 +70,11 @@ export class CookieService {
/** /**
* Delete a cookie Key. * Delete a cookie Key.
* @param key Key to identify the cookie * @param key Key to identify the cookie
* @param path "Pathname" to store the cookie
*/ */
deleteCookie(key: string): void { deleteCookie(key: string, path: string | null = null): void {
document.cookie = key + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;'; document.cookie = key + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;' +
(path ? `;path=${path}` : ';path=/');
} }
/** Placeholder for testing purposes - do not use. */ /** Placeholder for testing purposes - do not use. */