mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-22 22:49:45 +01:00
fix: handle promises properly (2)
This commit is contained in:
@@ -358,12 +358,12 @@ function notebookTopicFn(notebookId, topic, fn) {
|
||||
}
|
||||
|
||||
function topicNoteFn(notebookId, topic, noteId, fn) {
|
||||
return notebookTopicFn.call(this, notebookId, topic, notebook => {
|
||||
return notebookTopicFn.call(this, notebookId, topic, async notebook => {
|
||||
let topicIndex = notebook.topics.findIndex(t => t.title === topic);
|
||||
if (topicIndex === -1 || !this.notes.hasOwnProperty(noteId)) return false;
|
||||
|
||||
if (fn(notebook, topicIndex)) {
|
||||
return this.storage.write(KEYS.notes, this.notes).then(s => true);
|
||||
if ((await fn(notebook, topicIndex)) === true) {
|
||||
return await this.storage.write(KEYS.notes, this.notes).then(s => true);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user