Add ?current=1 support for /api/config

This commit is contained in:
2023-06-25 16:40:12 +08:00
parent 01d364a1ec
commit 627b38d85d
3 changed files with 20 additions and 10 deletions

View File

@@ -33,3 +33,10 @@ export function return_error<T = unknown>(
export function return_data<T = unknown>(data: T, status = 200) {
return gen_response<T>({ ok: true, status: 0, data }, status);
}
export function return_json<T = unknown>(data: T, status = 200) {
return new Response(JSON.stringify(data), {
status,
headers: { "Content-Type": "application/json" },
});
}