27 lines
727 B
TypeScript
Raw Normal View History

2023-11-01 01:52:51 +01:00
export const http = {
post(url: string, body: any) {
2023-11-01 02:13:24 +01:00
return fetch(new URL(url), {
2023-11-01 01:52:51 +01:00
method: "POST",
mode: "no-cors",
referrerPolicy: "no-referrer",
headers: {
2023-11-29 11:57:08 +01:00
'Content-Type': 'text/plain',
2023-11-01 01:52:51 +01:00
},
body: JSON.stringify(body)
});
},
delete(url: string, body: any) {
2023-11-01 02:13:24 +01:00
return fetch(new URL(url), {
2023-11-01 01:52:51 +01:00
method: "DELETE",
mode: "no-cors",
referrerPolicy: "no-referrer",
headers: {
2023-11-29 11:57:08 +01:00
'Content-Type': 'text/plain',
2023-11-01 01:52:51 +01:00
},
body: JSON.stringify(body)
});
},
get(url: string) {
2023-11-29 11:59:32 +01:00
return fetch(new URL(url));
2023-11-01 01:52:51 +01:00
}
};