From b0ec3cd3f2b41b4add912c66e3f7439f8ce5a411 Mon Sep 17 00:00:00 2001 From: Furrium Network Date: Sun, 9 Aug 2026 23:18:32 +0800 Subject: [PATCH] Update api.js --- js/api.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/js/api.js b/js/api.js index 9b88be0..494f63f 100644 --- a/js/api.js +++ b/js/api.js @@ -80,6 +80,15 @@ const API = { return data; }, + async updatePost(postId, title, content) { + const data = await apiFetch('/posts/' + postId, { + method: 'PUT', + body: JSON.stringify({ title, content }) + }); + if (data.error) throw new Error(data.error); + return data; + }, + async deletePost(postId) { const data = await apiFetch('/posts/' + postId, { method: 'DELETE' }); if (data.error) throw new Error(data.error);