using server.method() instead of direct call to $.ajax - preparation for electron without network requests

This commit is contained in:
azivner
2017-11-28 20:52:38 -05:00
parent 14001f67d8
commit 54c0ff15b3
17 changed files with 150 additions and 217 deletions

View File

@@ -30,16 +30,9 @@ const editTreePrefix = (function() {
formEl.submit(() => {
const prefix = treePrefixInputEl.val();
$.ajax({
url: baseApiUrl + 'tree/' + noteTreeId + '/setPrefix',
type: 'PUT',
contentType: 'application/json',
data: JSON.stringify({
prefix: prefix
}),
success: () => noteTree.setPrefix(noteTreeId, prefix),
error: () => showError("Error setting prefix.")
});
server.put('tree/' + noteTreeId + '/setPrefix', {
prefix: prefix
}).then(() => noteTree.setPrefix(noteTreeId, prefix));
dialogEl.dialog("close");