Skip to content

Commit

Permalink
fix: add note
Browse files Browse the repository at this point in the history
  • Loading branch information
shuowu committed May 27, 2020
1 parent bb3542a commit 0b2bf1f
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions extension/src/ui/store/videoNotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,17 @@ const videoNotesModel = {
createdAt: +new Date()
};
page = await storage.addPage(pageObj);
} else {
// Add note
if (!page.notes.find(note => note.id === id)) {
const addedNote = await storage.addNote(page.id, { id, ...note });
const notes = [...page.notes, addedNote].sort(
(n1, n2) => n1.timestamp - n2.timestamp
);
page = { ...page, notes };
}
}

// Add note
if (!page.notes.find(note => note.id === id)) {
const addedNote = await storage.addNote(page.id, { id, ...note });
const notes = [...page.notes, addedNote].sort(
(n1, n2) => n1.timestamp - n2.timestamp
);
page = { ...page, notes };
actions.setPage(page);
}

actions.setPage(page);
actions.editor.reset();
}),
removeNote: thunk(async (actions, noteId, { getState }) => {
Expand Down

0 comments on commit 0b2bf1f

Please sign in to comment.