🐛 修复新建节点后没有自动清空

This commit is contained in:
shufeng2012 committed 2026-07-24 09:34:41 +08:00
1 parent 7bb0124bbe
commit 787502b88d
1 file changed
+8 -6
+8 -6
View File
@@ -5,7 +5,7 @@
*/
async function getNode(token, id) {
try {
obj = { "pid": String(id) }
obj = { "pid": id }
jsonBody = JSON.stringify(obj)
console.log(jsonBody)
const res = await fetch('/get_notes', {
@@ -55,7 +55,7 @@ async function getNode(token, id) {
async function addNode(token, pid, title, content) {
try {
obj = {
"pid": String(pid),
"pid": pid,
"title": title,
"content": content
}
@@ -82,9 +82,11 @@ async function addNode(token, pid, title, content) {
}
if (!res.ok) {
throw new Error(result.message || `添加节点失败(HTTP ${res.status})`);
throw new Error(`添加节点失败(HTTP ${res.status})`);
}
input_note_title.value = "";
input_note_content.value = "";
getNode(token, stack[stack.length - 1]).then(load_notes);
//if (result.success) {
@@ -105,7 +107,7 @@ async function addNode(token, pid, title, content) {
async function deleteNode(token, id) {
try {
obj = {"id": String(id)};
obj = {"id": id};
jsonBody = JSON.stringify(obj);
console.log(jsonBody);
@@ -169,8 +171,8 @@ input_note_submit.addEventListener('click', function(event) {
var title = input_note_title.value
var content = input_note_content.value
var pid = (stack.length == 0) ? 0 : stack[stack.length - 1];
alert(stack.length)
alert(pid)
//alert(stack.length)
//alert(pid)
addNode(token, pid, title, content).then(result => {
alert(result.message);
})