fix: update setConfig function to allow optional value and fix API endpoint

This commit is contained in:
shiyu
2025-12-29 10:29:44 +08:00
parent 56f947d0bf
commit 91ff1860b7
4 changed files with 145 additions and 195 deletions

View File

@@ -1,13 +1,13 @@
import request from './client';
export async function getConfig(key: string) {
return request<{ key: string; value: string }>('/config?key=' + encodeURIComponent(key));
return request<{ key: string; value: string }>('/config/?key=' + encodeURIComponent(key));
}
export async function setConfig(key: string, value: string) {
export async function setConfig(key: string, value?: string | null) {
const form = new FormData();
form.append('key', key);
form.append('value', value);
form.append('value', value ?? '');
return request('/config/', { method: 'POST', formData: form });
}