mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 19:49:01 +01:00 
			
		
		
		
	all APIs are not prefixed with /api
This commit is contained in:
		
							parent
							
								
									ff58456332
								
							
						
					
					
						commit
						e28c06ef37
					
				
							
								
								
									
										7
									
								
								TODO
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								TODO
									
									
									
									
									
								
							| @ -1,7 +1,4 @@ | |||||||
| - logout detection | - logout detection | ||||||
| - conflict detection | - conflict detection | ||||||
| - deleting cloned nodes ends with 500 (probably only on folders) |   - note title and content changes are not in audit_log table | ||||||
| 
 | - deleting cloned nodes ends with 500 (probably only on folders) | ||||||
| Later: |  | ||||||
| - context menu on items (add subnote etc.) |  | ||||||
| - sync with sync server |  | ||||||
| @ -6,7 +6,7 @@ from sql import getSingleResult | |||||||
| 
 | 
 | ||||||
| audit_api = Blueprint('audit_api', __name__) | audit_api = Blueprint('audit_api', __name__) | ||||||
| 
 | 
 | ||||||
| @audit_api.route('/audit/<int:full_load_time>', methods = ['GET']) | @audit_api.route('/api/audit/<int:full_load_time>', methods = ['GET']) | ||||||
| @login_required | @login_required | ||||||
| def getNote(full_load_time): | def getNote(full_load_time): | ||||||
|     browser_id = request.headers['x-browser-id'] |     browser_id = request.headers['x-browser-id'] | ||||||
|  | |||||||
| @ -16,7 +16,7 @@ import audit_category | |||||||
| 
 | 
 | ||||||
| notes_api = Blueprint('notes_api', __name__) | notes_api = Blueprint('notes_api', __name__) | ||||||
| 
 | 
 | ||||||
| @notes_api.route('/notes/<string:note_id>', methods = ['GET']) | @notes_api.route('/api/notes/<string:note_id>', methods = ['GET']) | ||||||
| @login_required | @login_required | ||||||
| def getNote(note_id): | def getNote(note_id): | ||||||
|     execute("update options set opt_value = ? where opt_name = 'start_node'", [note_id]) |     execute("update options set opt_value = ? where opt_name = 'start_node'", [note_id]) | ||||||
| @ -34,7 +34,7 @@ def getNote(note_id): | |||||||
|         'images': getResults("select * from images where note_id = ? order by note_offset", [note_id]) |         'images': getResults("select * from images where note_id = ? order by note_offset", [note_id]) | ||||||
|     }) |     }) | ||||||
| 
 | 
 | ||||||
| @notes_api.route('/notes/<string:note_id>', methods = ['PUT']) | @notes_api.route('/api/notes/<string:note_id>', methods = ['PUT']) | ||||||
| @login_required | @login_required | ||||||
| def updateNote(note_id): | def updateNote(note_id): | ||||||
|     detail = getSingleResult("select * from notes where note_id = ?", [note_id]) |     detail = getSingleResult("select * from notes where note_id = ?", [note_id]) | ||||||
| @ -99,7 +99,7 @@ def updateNote(note_id): | |||||||
| 
 | 
 | ||||||
|     return jsonify({}) |     return jsonify({}) | ||||||
| 
 | 
 | ||||||
| @notes_api.route('/notes/<string:note_id>', methods = ['DELETE']) | @notes_api.route('/api/notes/<string:note_id>', methods = ['DELETE']) | ||||||
| @login_required | @login_required | ||||||
| def deleteNote(note_id): | def deleteNote(note_id): | ||||||
|     children = getResults("select note_id from notes_tree where note_pid = ?", [note_id]) |     children = getResults("select note_id from notes_tree where note_pid = ?", [note_id]) | ||||||
| @ -115,7 +115,7 @@ def deleteNote(note_id): | |||||||
|     commit() |     commit() | ||||||
|     return jsonify({}) |     return jsonify({}) | ||||||
| 
 | 
 | ||||||
| @notes_api.route('/notes/<string:parent_note_id>/children', methods = ['POST']) | @notes_api.route('/api/notes/<string:parent_note_id>/children', methods = ['POST']) | ||||||
| @login_required | @login_required | ||||||
| def createChild(parent_note_id): | def createChild(parent_note_id): | ||||||
|     note = request.get_json(force=True) |     note = request.get_json(force=True) | ||||||
| @ -173,7 +173,7 @@ def createChild(parent_note_id): | |||||||
|         'note_id': noteId |         'note_id': noteId | ||||||
|     }) |     }) | ||||||
| 
 | 
 | ||||||
| @notes_api.route('/notes', methods = ['GET']) | @notes_api.route('/api/notes', methods = ['GET']) | ||||||
| @login_required | @login_required | ||||||
| def searchNotes(): | def searchNotes(): | ||||||
|     search = '%' + request.args['search'] + '%' |     search = '%' + request.args['search'] + '%' | ||||||
|  | |||||||
| @ -14,14 +14,14 @@ from sql import getResults, getSingleResult | |||||||
| 
 | 
 | ||||||
| notes_history_api = Blueprint('notes_history_api', __name__) | notes_history_api = Blueprint('notes_history_api', __name__) | ||||||
| 
 | 
 | ||||||
| @notes_history_api.route('/notes-history/<string:note_id>', methods = ['GET']) | @notes_history_api.route('/api/notes-history/<string:note_id>', methods = ['GET']) | ||||||
| @login_required | @login_required | ||||||
| def getNoteHistory(note_id): | def getNoteHistory(note_id): | ||||||
|     history = getResults("select * from notes_history where note_id = ? order by date_modified desc", [note_id]) |     history = getResults("select * from notes_history where note_id = ? order by date_modified desc", [note_id]) | ||||||
| 
 | 
 | ||||||
|     return jsonify(history) |     return jsonify(history) | ||||||
| 
 | 
 | ||||||
| @notes_history_api.route('/recent-changes/', methods = ['GET']) | @notes_history_api.route('/api/recent-changes/', methods = ['GET']) | ||||||
| @login_required | @login_required | ||||||
| def getRecentChanges(): | def getRecentChanges(): | ||||||
|     recent_changes = getResults("select * from notes_history order by date_modified desc limit 1000") |     recent_changes = getResults("select * from notes_history order by date_modified desc limit 1000") | ||||||
|  | |||||||
| @ -8,7 +8,7 @@ from sql import getSingleResult | |||||||
| 
 | 
 | ||||||
| notes_move_api = Blueprint('notes_move_api', __name__) | notes_move_api = Blueprint('notes_move_api', __name__) | ||||||
| 
 | 
 | ||||||
| @notes_move_api.route('/notes/<string:note_id>/moveTo/<string:parent_id>', methods = ['PUT']) | @notes_move_api.route('/api/notes/<string:note_id>/moveTo/<string:parent_id>', methods = ['PUT']) | ||||||
| @login_required | @login_required | ||||||
| def moveToNote(note_id, parent_id): | def moveToNote(note_id, parent_id): | ||||||
|     res = getSingleResult('select max(note_pos) as max_note_pos from notes_tree where note_pid = ?', [parent_id]) |     res = getSingleResult('select max(note_pos) as max_note_pos from notes_tree where note_pid = ?', [parent_id]) | ||||||
| @ -27,7 +27,7 @@ def moveToNote(note_id, parent_id): | |||||||
|     commit() |     commit() | ||||||
|     return jsonify({}) |     return jsonify({}) | ||||||
| 
 | 
 | ||||||
| @notes_move_api.route('/notes/<string:note_id>/moveBefore/<string:before_note_id>', methods = ['PUT']) | @notes_move_api.route('/api/notes/<string:note_id>/moveBefore/<string:before_note_id>', methods = ['PUT']) | ||||||
| def moveBeforeNote(note_id, before_note_id): | def moveBeforeNote(note_id, before_note_id): | ||||||
|     before_note = getSingleResult("select * from notes_tree where note_id = ?", [before_note_id]) |     before_note = getSingleResult("select * from notes_tree where note_id = ?", [before_note_id]) | ||||||
| 
 | 
 | ||||||
| @ -42,7 +42,7 @@ def moveBeforeNote(note_id, before_note_id): | |||||||
| 
 | 
 | ||||||
|     return jsonify({}) |     return jsonify({}) | ||||||
| 
 | 
 | ||||||
| @notes_move_api.route('/notes/<string:note_id>/moveAfter/<string:after_note_id>', methods = ['PUT']) | @notes_move_api.route('/api/notes/<string:note_id>/moveAfter/<string:after_note_id>', methods = ['PUT']) | ||||||
| def moveAfterNote(note_id, after_note_id): | def moveAfterNote(note_id, after_note_id): | ||||||
|     after_note = getSingleResult("select * from notes_tree where note_id = ?", [after_note_id]) |     after_note = getSingleResult("select * from notes_tree where note_id = ?", [after_note_id]) | ||||||
| 
 | 
 | ||||||
| @ -57,7 +57,7 @@ def moveAfterNote(note_id, after_note_id): | |||||||
| 
 | 
 | ||||||
|     return jsonify({}) |     return jsonify({}) | ||||||
| 
 | 
 | ||||||
| @notes_move_api.route('/notes/<string:note_id>/expanded/<int:expanded>', methods = ['PUT']) | @notes_move_api.route('/api/notes/<string:note_id>/expanded/<int:expanded>', methods = ['PUT']) | ||||||
| def setExpandedNote(note_id, expanded): | def setExpandedNote(note_id, expanded): | ||||||
|     execute("update notes_tree set is_expanded = ? where note_id = ?", [expanded, note_id]) |     execute("update notes_tree set is_expanded = ? where note_id = ?", [expanded, note_id]) | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -7,7 +7,7 @@ import change_password | |||||||
| 
 | 
 | ||||||
| password_api = Blueprint('password_api', __name__) | password_api = Blueprint('password_api', __name__) | ||||||
| 
 | 
 | ||||||
| @password_api.route('/password/change', methods = ['POST']) | @password_api.route('/api/password/change', methods = ['POST']) | ||||||
| @login_required | @login_required | ||||||
| def changePassword(): | def changePassword(): | ||||||
|     req = request.get_json(force=True) |     req = request.get_json(force=True) | ||||||
|  | |||||||
| @ -8,7 +8,7 @@ settings_api = Blueprint('settings_api', __name__) | |||||||
| 
 | 
 | ||||||
| allowed_options = [ 'encryption_session_timeout', 'history_snapshot_time_interval' ] | allowed_options = [ 'encryption_session_timeout', 'history_snapshot_time_interval' ] | ||||||
| 
 | 
 | ||||||
| @settings_api.route('/settings', methods = ['GET']) | @settings_api.route('/api/settings', methods = ['GET']) | ||||||
| @login_required | @login_required | ||||||
| def get_settings(): | def get_settings(): | ||||||
|     dict = {} |     dict = {} | ||||||
| @ -20,7 +20,7 @@ def get_settings(): | |||||||
| 
 | 
 | ||||||
|     return jsonify(dict) |     return jsonify(dict) | ||||||
| 
 | 
 | ||||||
| @settings_api.route('/settings', methods = ['POST']) | @settings_api.route('/api/settings', methods = ['POST']) | ||||||
| @login_required | @login_required | ||||||
| def set_settings(): | def set_settings(): | ||||||
|     req = request.get_json(force=True) |     req = request.get_json(force=True) | ||||||
|  | |||||||
| @ -188,7 +188,7 @@ | |||||||
|     </div> |     </div> | ||||||
| 
 | 
 | ||||||
|     <script type="text/javascript"> |     <script type="text/javascript"> | ||||||
|       const baseUrl = ''; |       const baseApiUrl = 'api/'; | ||||||
|     </script> |     </script> | ||||||
| 
 | 
 | ||||||
|     <script src="stat/lib/jquery.min.js"></script> |     <script src="stat/lib/jquery.min.js"></script> | ||||||
|  | |||||||
| @ -10,7 +10,7 @@ from sql import getResults, getSingleResult, getOption | |||||||
| 
 | 
 | ||||||
| tree_api = Blueprint('tree_api', __name__) | tree_api = Blueprint('tree_api', __name__) | ||||||
| 
 | 
 | ||||||
| @tree_api.route('/tree', methods = ['GET']) | @tree_api.route('/api/tree', methods = ['GET']) | ||||||
| @login_required | @login_required | ||||||
| def getTree(): | def getTree(): | ||||||
|     notes = getResults("select " |     notes = getResults("select " | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| function convertNoteToHtml(noteId, failedNotes) { | function convertNoteToHtml(noteId, failedNotes) { | ||||||
|     $.ajax({ |     $.ajax({ | ||||||
|         url: baseUrl + 'notes/' + noteId, |         url: baseApiUrl + 'notes/' + noteId, | ||||||
|         type: 'GET', |         type: 'GET', | ||||||
|         async: false, |         async: false, | ||||||
|         success: function (note) { |         success: function (note) { | ||||||
| @ -18,7 +18,7 @@ function convertNoteToHtml(noteId, failedNotes) { | |||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             $.ajax({ |             $.ajax({ | ||||||
|                 url: baseUrl + 'notes/' + noteId, |                 url: baseApiUrl + 'notes/' + noteId, | ||||||
|                 type: 'PUT', |                 type: 'PUT', | ||||||
|                 data: JSON.stringify(note), |                 data: JSON.stringify(note), | ||||||
|                 contentType: "application/json", |                 contentType: "application/json", | ||||||
|  | |||||||
| @ -338,7 +338,7 @@ function updateSubTreeRecursively(noteId, updateCallback, successCallback) { | |||||||
| 
 | 
 | ||||||
| function updateNoteSynchronously(noteId, updateCallback, successCallback) { | function updateNoteSynchronously(noteId, updateCallback, successCallback) { | ||||||
|     $.ajax({ |     $.ajax({ | ||||||
|         url: baseUrl + 'notes/' + noteId, |         url: baseApiUrl + 'notes/' + noteId, | ||||||
|         type: 'GET', |         type: 'GET', | ||||||
|         async: false, |         async: false, | ||||||
|         success: function (note) { |         success: function (note) { | ||||||
| @ -353,7 +353,7 @@ function updateNoteSynchronously(noteId, updateCallback, successCallback) { | |||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             $.ajax({ |             $.ajax({ | ||||||
|                 url: baseUrl + 'notes/' + noteId, |                 url: baseApiUrl + 'notes/' + noteId, | ||||||
|                 type: 'PUT', |                 type: 'PUT', | ||||||
|                 data: JSON.stringify(note), |                 data: JSON.stringify(note), | ||||||
|                 contentType: "application/json", |                 contentType: "application/json", | ||||||
|  | |||||||
| @ -94,7 +94,7 @@ function updateNoteFromInputs(note) { | |||||||
| 
 | 
 | ||||||
| function saveNoteToServer(note, callback) { | function saveNoteToServer(note, callback) { | ||||||
|     $.ajax({ |     $.ajax({ | ||||||
|         url: baseUrl + 'notes/' + note.detail.note_id, |         url: baseApiUrl + 'notes/' + note.detail.note_id, | ||||||
|         type: 'PUT', |         type: 'PUT', | ||||||
|         data: JSON.stringify(note), |         data: JSON.stringify(note), | ||||||
|         contentType: "application/json", |         contentType: "application/json", | ||||||
| @ -134,7 +134,7 @@ function createNote(node, parentKey, target, encryption) { | |||||||
|     const newNoteNameEncryptedIfNecessary = encryption > 0 ? encryptString(newNoteName) : newNoteName; |     const newNoteNameEncryptedIfNecessary = encryption > 0 ? encryptString(newNoteName) : newNoteName; | ||||||
| 
 | 
 | ||||||
|     $.ajax({ |     $.ajax({ | ||||||
|         url: baseUrl + 'notes/' + parentKey + '/children' , |         url: baseApiUrl + 'notes/' + parentKey + '/children' , | ||||||
|         type: 'POST', |         type: 'POST', | ||||||
|         data: JSON.stringify({ |         data: JSON.stringify({ | ||||||
|             note_title: newNoteNameEncryptedIfNecessary, |             note_title: newNoteNameEncryptedIfNecessary, | ||||||
| @ -192,7 +192,7 @@ function setNoteBackgroundIfEncrypted(note) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function loadNote(noteId) { | function loadNote(noteId) { | ||||||
|     $.get(baseUrl + 'notes/' + noteId).then(function(note) { |     $.get(baseApiUrl + 'notes/' + noteId).then(function(note) { | ||||||
|         globalCurrentNote = note; |         globalCurrentNote = note; | ||||||
| 
 | 
 | ||||||
|         if (newNoteCreated) { |         if (newNoteCreated) { | ||||||
|  | |||||||
| @ -11,7 +11,7 @@ $(document).bind('keydown', 'alt+h', function() { | |||||||
|     $("#noteHistoryContent").empty(); |     $("#noteHistoryContent").empty(); | ||||||
| 
 | 
 | ||||||
|     $.ajax({ |     $.ajax({ | ||||||
|         url: baseUrl + 'notes-history/' + globalCurrentNote.detail.note_id, |         url: baseApiUrl + 'notes-history/' + globalCurrentNote.detail.note_id, | ||||||
|         type: 'GET', |         type: 'GET', | ||||||
|         success: function (result) { |         success: function (result) { | ||||||
|             globalHistoryItems = result; |             globalHistoryItems = result; | ||||||
|  | |||||||
| @ -6,7 +6,7 @@ $(document).bind('keydown', 'alt+r', function() { | |||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     $.ajax({ |     $.ajax({ | ||||||
|         url: baseUrl + 'recent-changes/', |         url: baseApiUrl + 'recent-changes/', | ||||||
|         type: 'GET', |         type: 'GET', | ||||||
|         success: function (result) { |         success: function (result) { | ||||||
|             const groupedByDate = {}; |             const groupedByDate = {}; | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| function displaySettings() { | function displaySettings() { | ||||||
|     $.ajax({ |     $.ajax({ | ||||||
|         url: baseUrl + 'settings', |         url: baseApiUrl + 'settings', | ||||||
|         type: 'GET', |         type: 'GET', | ||||||
|         success: function (result) { |         success: function (result) { | ||||||
|             $("#encryptionTimeoutInSeconds").val(result['encryption_session_timeout']); |             $("#encryptionTimeoutInSeconds").val(result['encryption_session_timeout']); | ||||||
| @ -32,7 +32,7 @@ $("#changePasswordForm").submit(() => { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     $.ajax({ |     $.ajax({ | ||||||
|         url: baseUrl + 'password/change', |         url: baseApiUrl + 'password/change', | ||||||
|         type: 'POST', |         type: 'POST', | ||||||
|         data: JSON.stringify({ |         data: JSON.stringify({ | ||||||
|             'current_password': oldPassword, |             'current_password': oldPassword, | ||||||
| @ -64,7 +64,7 @@ $("#encryptionTimeoutForm").submit(() => { | |||||||
|     const encryptionTimeout = $("#encryptionTimeoutInSeconds").val(); |     const encryptionTimeout = $("#encryptionTimeoutInSeconds").val(); | ||||||
| 
 | 
 | ||||||
|     $.ajax({ |     $.ajax({ | ||||||
|         url: baseUrl + 'settings', |         url: baseApiUrl + 'settings', | ||||||
|         type: 'POST', |         type: 'POST', | ||||||
|         data: JSON.stringify({ |         data: JSON.stringify({ | ||||||
|             name: 'encryption_session_timeout', |             name: 'encryption_session_timeout', | ||||||
| @ -86,7 +86,7 @@ $("#historySnapshotTimeIntervalForm").submit(() => { | |||||||
|     const historySnapshotTimeInterval = $("#historySnapshotTimeIntervalInSeconds").val(); |     const historySnapshotTimeInterval = $("#historySnapshotTimeIntervalInSeconds").val(); | ||||||
| 
 | 
 | ||||||
|     $.ajax({ |     $.ajax({ | ||||||
|         url: baseUrl + 'settings', |         url: baseApiUrl + 'settings', | ||||||
|         type: 'POST', |         type: 'POST', | ||||||
|         data: JSON.stringify({ |         data: JSON.stringify({ | ||||||
|             name: 'history_snapshot_time_interval', |             name: 'history_snapshot_time_interval', | ||||||
|  | |||||||
| @ -76,7 +76,7 @@ function setExpandedToServer(note_id, is_expanded) { | |||||||
|     expanded_num = is_expanded ? 1 : 0; |     expanded_num = is_expanded ? 1 : 0; | ||||||
| 
 | 
 | ||||||
|     $.ajax({ |     $.ajax({ | ||||||
|         url: baseUrl + 'notes/' + note_id + '/expanded/' + expanded_num, |         url: baseApiUrl + 'notes/' + note_id + '/expanded/' + expanded_num, | ||||||
|         type: 'PUT', |         type: 'PUT', | ||||||
|         contentType: "application/json", |         contentType: "application/json", | ||||||
|         success: function(result) {} |         success: function(result) {} | ||||||
| @ -89,7 +89,7 @@ let globalEncryptedDataKey; | |||||||
| let globalFullLoadTime; | let globalFullLoadTime; | ||||||
| 
 | 
 | ||||||
| setInterval(() => { | setInterval(() => { | ||||||
|     $.get(baseUrl + 'audit/' + globalFullLoadTime).then(resp => { |     $.get(baseApiUrl + 'audit/' + globalFullLoadTime).then(resp => { | ||||||
|         if (resp.changed) { |         if (resp.changed) { | ||||||
|             window.location.reload(true); |             window.location.reload(true); | ||||||
|         } |         } | ||||||
| @ -97,7 +97,7 @@ setInterval(() => { | |||||||
| }, 60 * 1000); | }, 60 * 1000); | ||||||
| 
 | 
 | ||||||
| $(function(){ | $(function(){ | ||||||
|     $.get(baseUrl + 'tree').then(resp => { |     $.get(baseApiUrl + 'tree').then(resp => { | ||||||
|         const notes = resp.notes; |         const notes = resp.notes; | ||||||
|         let startNoteId = resp.start_note_id; |         let startNoteId = resp.start_note_id; | ||||||
|         globalEncryptionSalt = resp.password_derived_key_salt; |         globalEncryptionSalt = resp.password_derived_key_salt; | ||||||
| @ -169,7 +169,7 @@ $("input[name=search]").keyup(function (e) { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (e && e.which === $.ui.keyCode.ENTER) { |     if (e && e.which === $.ui.keyCode.ENTER) { | ||||||
|         $.get(baseUrl + 'notes?search=' + searchString).then(resp => { |         $.get(baseApiUrl + 'notes?search=' + searchString).then(resp => { | ||||||
|             console.log("search: ", resp); |             console.log("search: ", resp); | ||||||
| 
 | 
 | ||||||
|             // Pass a string to perform case insensitive matching
 |             // Pass a string to perform case insensitive matching
 | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| function moveBeforeNode(node, beforeNode) { | function moveBeforeNode(node, beforeNode) { | ||||||
|     $.ajax({ |     $.ajax({ | ||||||
|         url: baseUrl + 'notes/' + node.key + '/moveBefore/' + beforeNode.key, |         url: baseApiUrl + 'notes/' + node.key + '/moveBefore/' + beforeNode.key, | ||||||
|         type: 'PUT', |         type: 'PUT', | ||||||
|         contentType: "application/json", |         contentType: "application/json", | ||||||
|         success: function () { |         success: function () { | ||||||
| @ -11,7 +11,7 @@ function moveBeforeNode(node, beforeNode) { | |||||||
| 
 | 
 | ||||||
| function moveAfterNode(node, afterNode) { | function moveAfterNode(node, afterNode) { | ||||||
|     $.ajax({ |     $.ajax({ | ||||||
|         url: baseUrl + 'notes/' + node.key + '/moveAfter/' + afterNode.key, |         url: baseApiUrl + 'notes/' + node.key + '/moveAfter/' + afterNode.key, | ||||||
|         type: 'PUT', |         type: 'PUT', | ||||||
|         contentType: "application/json", |         contentType: "application/json", | ||||||
|         success: function () { |         success: function () { | ||||||
| @ -22,7 +22,7 @@ function moveAfterNode(node, afterNode) { | |||||||
| 
 | 
 | ||||||
| function moveToNode(node, toNode) { | function moveToNode(node, toNode) { | ||||||
|     $.ajax({ |     $.ajax({ | ||||||
|         url: baseUrl + 'notes/' + node.key + '/moveTo/' + toNode.key, |         url: baseApiUrl + 'notes/' + node.key + '/moveTo/' + toNode.key, | ||||||
|         type: 'PUT', |         type: 'PUT', | ||||||
|         contentType: "application/json", |         contentType: "application/json", | ||||||
|         success: function () { |         success: function () { | ||||||
| @ -39,7 +39,7 @@ function moveToNode(node, toNode) { | |||||||
| function deleteNode(node) { | function deleteNode(node) { | ||||||
|     if (confirm('Are you sure you want to delete note "' + node.title + '"?')) { |     if (confirm('Are you sure you want to delete note "' + node.title + '"?')) { | ||||||
|         $.ajax({ |         $.ajax({ | ||||||
|             url: baseUrl + 'notes/' + node.key, |             url: baseApiUrl + 'notes/' + node.key, | ||||||
|             type: 'DELETE', |             type: 'DELETE', | ||||||
|             success: function () { |             success: function () { | ||||||
|                 if (node.getParent() !== null && node.getParent().getChildren().length <= 1) { |                 if (node.getParent() !== null && node.getParent().getChildren().length <= 1) { | ||||||
| @ -69,7 +69,7 @@ function deleteNode(node) { | |||||||
| function moveNodeUp(node) { | function moveNodeUp(node) { | ||||||
|     if (node.getParent() !== null) { |     if (node.getParent() !== null) { | ||||||
|         $.ajax({ |         $.ajax({ | ||||||
|             url: baseUrl + 'notes/' + node.key + '/moveAfter/' + node.getParent().key, |             url: baseApiUrl + 'notes/' + node.key + '/moveAfter/' + node.getParent().key, | ||||||
|             type: 'PUT', |             type: 'PUT', | ||||||
|             contentType: "application/json", |             contentType: "application/json", | ||||||
|             success: function () { |             success: function () { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 azivner
						azivner