mirror of
https://github.com/DrizzleTime/Foxel.git
synced 2026-07-17 18:42:37 +08:00
fix: update setConfig function to allow optional value and fix API endpoint
This commit is contained in:
@@ -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 });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user