Release 202412292127

This commit is contained in:
Adam Shiervani
2024-10-20 17:24:15 +02:00
commit 20780b65db
171 changed files with 24344 additions and 0 deletions

22
ui/src/api.ts Normal file
View File

@@ -0,0 +1,22 @@
function api(url: string, options: RequestInit): Promise<Response> {
const baseOptions: RequestInit = {
mode: "cors",
credentials: "include",
headers: {
"Content-Type": "application/json",
},
...options,
};
return fetch(url, baseOptions);
}
export default Object.assign(api, {
GET: (url: string, options?: RequestInit) => api(url, { method: "GET", ...options }),
POST: (url: string, body?: object, options?: RequestInit) =>
api(url, { method: "POST", body: JSON.stringify(body), ...options }),
PUT: (url: string, body?: object, options?: RequestInit) =>
api(url, { method: "PUT", body: JSON.stringify(body), ...options }),
DELETE: (url: string, body?: object, options?: RequestInit) =>
api(url, { method: "DELETE", body: JSON.stringify(body), ...options }),
});