mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-09-23 23:13:42 +02:00
[Bug] Cookies being fetched improperly v2
This commit is contained in:
parent
6ce59ecbd9
commit
85c38dfdbe
@ -23,10 +23,12 @@ export function getCookie(cName: string): string {
|
|||||||
}
|
}
|
||||||
const name = `${cName}=`;
|
const name = `${cName}=`;
|
||||||
const ca = document.cookie.split(";");
|
const ca = document.cookie.split(";");
|
||||||
// Check all cookies in the document and see if any of them match, grabbing the first one whose value lines up
|
for (let c of ca) {
|
||||||
for (const c of ca) {
|
// ⚠️ DO NOT REPLACE THIS WITH C = C.TRIM() - IT BREAKS IN NON-CHROMIUM BROWSERS ⚠️
|
||||||
const cTrimmed = c.trimStart();
|
while (c.charAt(0) === " ") {
|
||||||
if (cTrimmed.startsWith(name)) {
|
c = c.substring(1);
|
||||||
|
}
|
||||||
|
if (c.indexOf(name) === 0) {
|
||||||
return c.substring(name.length, c.length);
|
return c.substring(name.length, c.length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user