mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
🐛 修复数据库初始化异常
This commit is contained in:
14
src/App.vue
14
src/App.vue
@@ -100,6 +100,7 @@ onMounted(async () => {
|
||||
function listenOnInit(): void {
|
||||
console.info("[App][listenOnInit] 监听初始化事件!");
|
||||
event.listen("initApp", async () => {
|
||||
await checkAppLoad();
|
||||
await checkDeviceFp();
|
||||
try {
|
||||
await checkUserLoad();
|
||||
@@ -112,6 +113,19 @@ function listenOnInit(): void {
|
||||
});
|
||||
}
|
||||
|
||||
async function checkAppLoad(): Promise<void> {
|
||||
let checkDB = false;
|
||||
try {
|
||||
checkDB = await TGSqlite.check();
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
await TGLogger.Error(`[App][checkAppLoad] ${error.name}: ${error.message}`);
|
||||
} else console.error(error);
|
||||
}
|
||||
if (!checkDB) await TGSqlite.update();
|
||||
else await TGLogger.Info("[App][checkAppLoad] 数据库已成功加载!");
|
||||
}
|
||||
|
||||
// 检测 deviceFp
|
||||
async function checkDeviceFp(): Promise<void> {
|
||||
const appData = await TGSqlite.getAppData();
|
||||
|
||||
Reference in New Issue
Block a user