try get first

This commit is contained in:
Tony
2024-10-03 13:56:43 +08:00
parent 3acf66ee57
commit 42c5a1cb56
5 changed files with 7 additions and 5 deletions
+2 -2
View File
@@ -56,8 +56,8 @@ export class LazyStore implements IStore {
private get store(): Promise<Store> {
if (!this._store) {
this._store = createStore(this.path, this.options).catch(
async () => (await getStore(this.path))!
this._store = getStore(this.path).then(
async (store) => store || (await createStore(this.path, this.options))
)
}
return this._store