Fix 401 cause CORS not works

This commit is contained in:
2023-08-30 15:28:29 +08:00
parent 5d93f5d39f
commit 0c98f8f5f8
2 changed files with 11 additions and 2 deletions

View File

@@ -29,8 +29,10 @@ function gen_response<T>(
export function return_error<T = unknown>(
status: Exclude<number, 0>,
error: string,
http_status = 200,
headers: HeadersInit = {},
) {
return gen_response<T>({ ok: false, status, error });
return gen_response<T>({ ok: false, status, error }, http_status, headers);
}
export function return_data<T = unknown>(