From daba717571838e0f417ee080092ccf2f08f5552c Mon Sep 17 00:00:00 2001 From: Furrium Network Date: Sun, 9 Aug 2026 23:02:28 +0800 Subject: [PATCH] Update api.js --- js/api.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/js/api.js b/js/api.js index 1208407..9b88be0 100644 --- a/js/api.js +++ b/js/api.js @@ -268,7 +268,6 @@ const API = { // ============================================================ // 自定义页面 // ============================================================ - async getCustomPages() { const data = await apiFetch('/custom-pages'); if (data.error) throw new Error(data.error); @@ -309,5 +308,17 @@ const API = { const data = await apiFetch('/admin/custom-pages/' + id, { method: 'DELETE' }); if (data.error) throw new Error(data.error); return data; + }, + + // ============================================================ + // 头像 + // ============================================================ + async updateAvatar(userId, avatar_url) { + const data = await apiFetch('/users/' + userId + '/avatar', { + method: 'PUT', + body: JSON.stringify({ avatar_url }) + }); + if (data.error) throw new Error(data.error); + return data; } };