protect/unprotect subtree

This commit is contained in:
azivner
2017-11-15 00:04:26 -05:00
parent c2ad14ba18
commit 9cf935efd1
5 changed files with 109 additions and 29 deletions

View File

@@ -147,6 +147,20 @@ const protected_session = (function() {
}
}
async function protectSubTree(noteId, protect) {
await $.ajax({
url: baseApiUrl + 'tree/' + noteId + "/protectSubTree/" + (protect ? 1 : 0),
type: 'PUT',
contentType: 'application/json',
error: () => showError("Request to un/protect sub tree has failed.")
});
showMessage("Request to un/protect sub tree has finished successfully");
noteTree.reload();
noteEditor.reload();
}
passwordFormEl.submit(() => {
setupProtectedSession();
@@ -167,6 +181,7 @@ const protected_session = (function() {
protectNoteAndSendToServer,
unprotectNoteAndSendToServer,
getProtectedSessionId,
touchProtectedSession
touchProtectedSession,
protectSubTree
};
})();