Fix crashing in offline mode

pull/780/merge
Flashfyre 2024-05-15 01:42:36 -04:00
parent 7e0e4ecd6d
commit 751120e77e
1 changed files with 2 additions and 1 deletions

View File

@ -12,6 +12,7 @@ export const clientSessionId = Utils.randomString(32);
export function updateUserInfo(): Promise<[boolean, integer]> { export function updateUserInfo(): Promise<[boolean, integer]> {
return new Promise<[boolean, integer]>(resolve => { return new Promise<[boolean, integer]>(resolve => {
if (bypassLogin) { if (bypassLogin) {
loggedInUser = { username: 'Guest', lastSessionSlot: -1 };
let lastSessionSlot = -1; let lastSessionSlot = -1;
for (let s = 0; s < 2; s++) { for (let s = 0; s < 2; s++) {
if (localStorage.getItem(`sessionData${s ? s : ''}_${loggedInUser.username}`)) { if (localStorage.getItem(`sessionData${s ? s : ''}_${loggedInUser.username}`)) {
@ -19,7 +20,7 @@ export function updateUserInfo(): Promise<[boolean, integer]> {
break; break;
} }
} }
loggedInUser = { username: 'Guest', lastSessionSlot: lastSessionSlot }; loggedInUser.lastSessionSlot = lastSessionSlot;
return resolve([ true, 200 ]); return resolve([ true, 200 ]);
} }
Utils.apiFetch('account/info', true).then(response => { Utils.apiFetch('account/info', true).then(response => {