2023-12-02 18:09:46 +01:00

25 lines
654 B
TypeScript

export const http = {
post(url: string, body: any) {
return fetch(new URL(url), {
method: "POST",
mode: "no-cors",
referrerPolicy: "no-referrer",
headers: {
'Content-Type': 'text/plain',
},
body: JSON.stringify(body)
});
},
delete(url: string, body: any) {
return fetch(new URL(url), {
method: "DELETE",
headers: {
'Content-Type': 'text/plain',
},
body: JSON.stringify(body)
});
},
get(url: string) {
return fetch(new URL(url));
}
};