🐛 解决 account 初始化问题

This commit is contained in:
BTMuli
2023-10-11 00:04:33 +08:00
parent 1cd1c1f035
commit e32988f663

View File

@@ -106,7 +106,7 @@ async function checkUserLoad(): Promise<void> {
await new Promise((resolve) => {
setTimeout(() => {
showSnackbar({
text: "请先登录!",
text: "获取 Cookie 失败!请重新登录!",
color: "error",
timeout: 3000,
});
@@ -127,6 +127,22 @@ async function checkUserLoad(): Promise<void> {
} else {
console.info("briefInfo 数据已加载!");
}
const accountLocal = userStore.getCurAccount();
const accountDB = await TGSqlite.getCurAccount();
if (accountDB === false) {
showSnackbar({
text: "获取 GameAccount 失败!请尝试更新数据库!",
color: "error",
timeout: 3000,
});
return;
}
if (accountDB !== accountLocal) {
userStore.setCurAccount(accountDB);
console.info("curAccount 数据已更新!");
} else {
console.info("curAccount 数据已加载!");
}
}
// 创建数据文件夹
@@ -152,6 +168,7 @@ async function initData(): Promise<void> {
async function getDeepLink(): Promise<void> {
await event.listen("active_deep_link", (e) => {
console.log(e.payload);
new TauriWindow.WebviewWindow("TeyvatGuide")
.center()
.then(async () => {