Skip to content

Commit

Permalink
web: do not show success prompt on unlock cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
thecodrr committed Jan 29, 2024
1 parent 3592902 commit 807bd68
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
7 changes: 3 additions & 4 deletions apps/web/src/components/note/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,9 @@ const menuItems: (note: any, items?: any[]) => MenuItem[] = (
onClick: async () => {
const { unlock, lock } = store.get();
if (!note.locked) {
await lock(note.id);
showToast("success", "Note locked successfully!");
} else {
await unlock(note.id);
if (await lock(note.id))
showToast("success", "Note locked successfully!");
} else if (await unlock(note.id)) {
showToast("success", "Note unlocked successfully!");
}
},
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/stores/note-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,11 @@ class NoteStore extends BaseStore {
};

lock = async (id) => {
await Vault.lockNote(id);
if (!(await Vault.lockNote(id))) return false;
this.refreshItem(id);
if (editorStore.get().session.id === id)
await editorStore.openSession(id, true);
return true;
};

readonly = async (id) => {
Expand Down

0 comments on commit 807bd68

Please sign in to comment.