chore: Remove beta cookie when removing main domain cookie

This commit is contained in:
Frederico Santos 2024-08-16 00:29:25 +01:00
parent 3c4e56db2d
commit 5983c77a67
1 changed files with 4 additions and 0 deletions

View File

@ -281,6 +281,10 @@ export function setCookie(cName: string, cValue: string): void {
}
export function removeCookie(cName: string): void {
if (isBeta) {
document.cookie = `${cName}=;Secure;SameSite=Strict;Domain=pokerogue.net;Path=/;Max-Age=-1`; // we need to remove the cookie from the main domain as well
}
document.cookie = `${cName}=;Secure;SameSite=Strict;Domain=${window.location.hostname};Path=/;Max-Age=-1`;
document.cookie = `${cName}=;Secure;SameSite=Strict;Path=/;Max-Age=-1`; // legacy cookie without domain, for older cookies to prevent a login loop
}