Changes for getCurrentUser

This commit is contained in:
Natsumi
2024-08-29 16:37:42 +12:00
parent c584e3b51d
commit 7b4a9656aa
+20 -9
View File
@@ -5358,6 +5358,14 @@ speechSynthesis.getVoices();
} catch (err) {} } catch (err) {}
}; };
API.reconnectWebSocket = function () {
if (!$app.friendLogInitStatus) {
return;
}
this.closeWebSocket();
this.getAuth();
};
// #endregion // #endregion
// #region | API: Visit // #region | API: Visit
@@ -5634,8 +5642,13 @@ speechSynthesis.getVoices();
throw err; throw err;
}) })
.then((args) => { .then((args) => {
API.getCurrentUser().finally(() => { API.getCurrentUser()
.finally(() => {
this.loginForm.loading = false; this.loginForm.loading = false;
})
.catch((err) => {
this.nextCurrentUserRefresh = 120; // 1min
console.error(err);
}); });
return args; return args;
}); });
@@ -5758,16 +5771,14 @@ speechSynthesis.getVoices();
} }
if (--this.nextCurrentUserRefresh <= 0) { if (--this.nextCurrentUserRefresh <= 0) {
this.nextCurrentUserRefresh = 840; // 7mins this.nextCurrentUserRefresh = 840; // 7mins
API.getCurrentUser().catch((err1) => { API.getCurrentUser();
throw err1;
});
AppApi.CheckGameRunning();
} }
if (--this.nextGroupInstanceRefresh <= 0) { if (--this.nextGroupInstanceRefresh <= 0) {
if (this.friendLogInitStatus) { if (this.friendLogInitStatus) {
this.nextGroupInstanceRefresh = 600; // 5min this.nextGroupInstanceRefresh = 600; // 5min
API.getUsersGroupInstances(); API.getUsersGroupInstances();
} }
AppApi.CheckGameRunning();
} }
if (--this.nextAppUpdateCheck <= 0) { if (--this.nextAppUpdateCheck <= 0) {
if (this.branch === 'Stable') { if (this.branch === 'Stable') {
@@ -9072,12 +9083,12 @@ speechSynthesis.getVoices();
}); });
$app.methods.refreshFriendsList = async function () { $app.methods.refreshFriendsList = async function () {
await API.getCurrentUser(); await API.getCurrentUser().catch((err) => {
console.error(err);
});
this.nextCurrentUserRefresh = 840; // 7mins this.nextCurrentUserRefresh = 840; // 7mins
await API.refreshFriends(); await API.refreshFriends();
API.closeWebSocket(); API.reconnectWebSocket();
await API.getCurrentUser();
this.nextCurrentUserRefresh = 840; // 7mins
}; };
$app.methods.refreshFriends = function (ref, origin) { $app.methods.refreshFriends = function (ref, origin) {