feat: refine forum settings uploads and transitions
This commit is contained in:
1 parent
e85ced7319
commit
f5d173350b
23 files changed
+985
-54
No files matched your search
+11
@@ -127,6 +127,17 @@ export const API = {
|
||||
updateSettings(forum_name) {
|
||||
return apiFetch('/settings', { method: 'PUT', body: JSON.stringify({ forum_name }) });
|
||||
},
|
||||
uploadFavicon(file) {
|
||||
const fd = new FormData();
|
||||
fd.append('file', file);
|
||||
const headers = {};
|
||||
if (token) headers['Authorization'] = 'Bearer ' + token;
|
||||
return fetch('/api/admin/favicon', { method: 'POST', body: fd, headers }).then(async (res) => {
|
||||
const data = await res.json().catch(() => ({}));
|
||||
if (!res.ok || data.error) throw new Error(data.error || '上传失败');
|
||||
return data;
|
||||
});
|
||||
},
|
||||
getLinks() { return apiFetch('/links'); },
|
||||
addLink(title, url) {
|
||||
return apiFetch('/links', { method: 'POST', body: JSON.stringify({ title, url }) });
|
||||
|
||||
Reference in new issue
Block a user