feat: 添加对数据库初始化的调用,优化设置存储逻辑

This commit is contained in:
2025-08-29 14:47:20 +08:00
parent 244f702542
commit 3ff5d7fdc3
4 changed files with 125 additions and 8 deletions

View File

@@ -55,10 +55,10 @@ class SettingStore {
* 自动判断重连
*/
private _ensureDB = safe(async () => {
const { db, isDbClosed } = this
const { db, isDbClosed, initDB } = this
if (!db || isDbClosed) {
this.db = await openDatabase({ name: DB_SETTINGS_NAME })
await initDB()
this.isDbClosed = false
}
})
@@ -182,5 +182,3 @@ class SettingStore {
* ```
*/
export const settingsStore = new SettingStore()
await settingsStore.initDB()