mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-01 05:52:17 +02:00
fix: Remove unnecessary cookie setting in LoginPhase and MenuUiHandler
This commit is contained in:
parent
4c655691e5
commit
93bcf8ade9
@ -98,7 +98,7 @@ export class LoginPhase extends Phase {
|
|||||||
const loadData = () => {
|
const loadData = () => {
|
||||||
updateUserInfo().then(success => {
|
updateUserInfo().then(success => {
|
||||||
if (!success[0]) {
|
if (!success[0]) {
|
||||||
Utils.setCookie(Utils.sessionIdKey, "");
|
Utils.removeCookie(Utils.sessionIdKey);
|
||||||
this.scene.reset(true, true);
|
this.scene.reset(true, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -119,7 +119,7 @@ export class LoginPhase extends Phase {
|
|||||||
this.scene.ui.playSelect();
|
this.scene.ui.playSelect();
|
||||||
updateUserInfo().then(success => {
|
updateUserInfo().then(success => {
|
||||||
if (!success[0]) {
|
if (!success[0]) {
|
||||||
Utils.setCookie(Utils.sessionIdKey, "");
|
Utils.removeCookie(Utils.sessionIdKey);
|
||||||
this.scene.reset(true, true);
|
this.scene.reset(true, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ export class LoginPhase extends Phase {
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
} else if (statusCode === 401) {
|
} else if (statusCode === 401) {
|
||||||
Utils.setCookie(Utils.sessionIdKey, "");
|
Utils.removeCookie(Utils.sessionIdKey);
|
||||||
this.scene.reset(true, true);
|
this.scene.reset(true, true);
|
||||||
} else {
|
} else {
|
||||||
this.scene.unshiftPhase(new UnavailablePhase(this.scene));
|
this.scene.unshiftPhase(new UnavailablePhase(this.scene));
|
||||||
|
@ -462,7 +462,7 @@ export default class MenuUiHandler extends MessageUiHandler {
|
|||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
console.error(`Log out failed (${res.status}: ${res.statusText})`);
|
console.error(`Log out failed (${res.status}: ${res.statusText})`);
|
||||||
}
|
}
|
||||||
Utils.setCookie(Utils.sessionIdKey, "");
|
Utils.removeCookie(Utils.sessionIdKey);
|
||||||
updateUserInfo().then(() => this.scene.reset(true, true));
|
updateUserInfo().then(() => this.scene.reset(true, true));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -58,7 +58,7 @@ export default class UnavailableModalUiHandler extends ModalUiHandler {
|
|||||||
this.scene.playSound("pb_bounce_1");
|
this.scene.playSound("pb_bounce_1");
|
||||||
this.reconnectCallback();
|
this.reconnectCallback();
|
||||||
} else if (response[1] === 401) {
|
} else if (response[1] === 401) {
|
||||||
Utils.setCookie(Utils.sessionIdKey, "");
|
Utils.removeCookie(Utils.sessionIdKey);
|
||||||
this.scene.reset(true, true);
|
this.scene.reset(true, true);
|
||||||
} else {
|
} else {
|
||||||
this.reconnectDuration = Math.min(this.reconnectDuration * 2, this.maxTime); // Set a max delay so it isn't infinite
|
this.reconnectDuration = Math.min(this.reconnectDuration * 2, this.maxTime); // Set a max delay so it isn't infinite
|
||||||
|
@ -297,7 +297,11 @@ export const isBeta = import.meta.env.MODE === "beta"; // this checks to see if
|
|||||||
export function setCookie(cName: string, cValue: string): void {
|
export function setCookie(cName: string, cValue: string): void {
|
||||||
const expiration = new Date();
|
const expiration = new Date();
|
||||||
expiration.setTime(new Date().getTime() + 3600000 * 24 * 30 * 3/*7*/);
|
expiration.setTime(new Date().getTime() + 3600000 * 24 * 30 * 3/*7*/);
|
||||||
document.cookie = `${cName}=${cValue};Secure;SameSite=Strict;Domain=beta.pokerogue.net;Path=/;Expires=${expiration.toUTCString()}`;
|
document.cookie = `${cName}=${cValue};Secure;SameSite=Strict;Domain=${window.location.hostname};Path=/;Expires=${expiration.toUTCString()}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function removeCookie(cName: string): void {
|
||||||
|
document.cookie = `${cName}=;Secure;SameSite=Strict;Domain=${window.location.hostname};Path=/;Expires=Thu, 01 Jan 1970 00:00:00 GMT`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCookie(cName: string): string {
|
export function getCookie(cName: string): string {
|
||||||
|
Loading…
Reference in New Issue
Block a user