feat: prefix and anti multi-check

This commit is contained in:
KirinBaka
2025-04-22 15:34:22 +08:00
parent bebf2c9640
commit ffc89fd069
10 changed files with 46 additions and 28 deletions

View File

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