common get post method, and control, edit page

This commit is contained in:
2023-02-04 01:04:16 +08:00
parent e77173a8af
commit 849aecac6b
12 changed files with 175 additions and 537 deletions

14
common/index.tsx Normal file
View File

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