Fix crashing in offline mode
parent
7e0e4ecd6d
commit
751120e77e
|
@ -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 => {
|
||||||
|
|
Loading…
Reference in New Issue