Skip to content

Commit f39bd57

Browse files
committed
awaiting the promise execution.
1 parent 095596e commit f39bd57

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/apiManager.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,15 @@ export default class APIManager {
3434
const dir = this.plugin.settings.storiesFolder
3535
const filePath = path.join(dir, `${hnItem.title}.md`)
3636

37-
let stat = this.plugin.app.vault.adapter.stat(dir)
37+
let stat = await this.plugin.app.vault.adapter.stat(dir)
3838
if (!stat) {
39-
this.plugin.app.vault.createFolder(dir)
39+
await this.plugin.app.vault.createFolder(dir)
4040
}
4141

42-
stat = this.plugin.app.vault.adapter.stat(filePath)
42+
stat = await this.plugin.app.vault.adapter.stat(filePath)
43+
console.log(stat)
4344
if (!stat) {
44-
this.plugin.app.vault.create(filePath, `[${hnItem.title}](${hnItem.url})`)
45+
await this.plugin.app.vault.create(filePath, `[${hnItem.title}](${hnItem.url})`)
4546
new Notice(`Story saved: ${hnItem.title}`)
4647
}
4748
}

0 commit comments

Comments
 (0)