Update api.js

This commit is contained in:
Furrium Network authored and GitHub committed 2026-08-09 23:18:32 +08:00
1 parent 7a451f2013
commit b0ec3cd3f2
1 file changed
+9
+9
View File
@@ -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);