fix token on edit page

This commit is contained in:
2023-02-16 23:28:48 +08:00
parent ce2adb9b81
commit 81e1e6ce9c
2 changed files with 13 additions and 3 deletions

View File

@@ -3,10 +3,14 @@ export const get = async (url: string) => {
const json = await resp.json();
return json;
};
export const post = async (url: string, json: any) => {
export const post = async (
url: string,
json: any,
headers: Record<string, string> = {}
) => {
const resp = await fetch(url, {
method: "POST",
headers: { "Content-Type": "application/json" },
headers: { "Content-Type": "application/json", ...headers },
body: JSON.stringify(json),
});
const result = await resp.json();