mirror of
https://github.com/leanote/desktop-app.git
synced 2025-12-22 01:07:19 +08:00
send changes note.update [ok]
This commit is contained in:
28
node_modules/api.js
generated
vendored
28
node_modules/api.js
generated
vendored
@@ -322,18 +322,34 @@ var Api = {
|
||||
//--------
|
||||
|
||||
// 获取笔记
|
||||
// noteId是serverNoteId
|
||||
getNote: function(noteId, callback) {
|
||||
|
||||
needle.get(this.getUrl('note/getNote', {NoteId: noteId}), function(error, response) {
|
||||
if(error) {
|
||||
return callback && callback(false);
|
||||
}
|
||||
var ret = response.body;
|
||||
if(Common.isOk(ret)) {
|
||||
callback && callback(ret);
|
||||
} else {
|
||||
log(error);
|
||||
callback && callback(false);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 添加
|
||||
addNote: function(note, callback) {
|
||||
var me = this;
|
||||
// note.NotebookId是本的, 要得到远程的
|
||||
Notebook.getServerNotebookIdByNotebookId(notebook.NotebookId, function(serverNotebookId) {
|
||||
Notebook.getServerNotebookIdByNotebookId(note.NotebookId, function(serverNotebookId) {
|
||||
var data = {
|
||||
title: note.Title,
|
||||
notebookId: serverNotebookId
|
||||
notebookId: serverNotebookId,
|
||||
content: note.Content,
|
||||
isMarkdown: note.isMarkdown,
|
||||
Tags: note.Tags,
|
||||
IsBlog: note.IsBlog
|
||||
}
|
||||
log('add note');
|
||||
log(data);
|
||||
@@ -342,6 +358,7 @@ var Api = {
|
||||
return callback(false);
|
||||
}
|
||||
var ret = resp.body;
|
||||
log('add note ret');
|
||||
log(ret);
|
||||
if(Common.isOk(ret)) {
|
||||
callback(ret);
|
||||
@@ -354,13 +371,14 @@ var Api = {
|
||||
// 更新
|
||||
updateNote: function(note, callback) {
|
||||
var me = this;
|
||||
Notebook.getServerNotebookIdByNotebookId(notebook.NotebookId, function(serverNotebookId) {
|
||||
Notebook.getServerNotebookIdByNotebookId(note.NotebookId, function(serverNotebookId) {
|
||||
var data = {
|
||||
noteId: note.ServerNoteId,
|
||||
notebookId: serverNotebookId || "",
|
||||
title: note.Title,
|
||||
usn: note.Usn,
|
||||
isTrash: note.IsTrash
|
||||
isTrash: note.IsTrash,
|
||||
content: note.Content
|
||||
}
|
||||
log('update note');
|
||||
log(data);
|
||||
|
||||
Reference in New Issue
Block a user