learnhouse/front/services/utils/requests.ts
2023-01-22 19:12:12 +01:00

14 lines
344 B
TypeScript

export const RequestBody = (method: string, data: any) => {
let HeadersConfig = new Headers({ "Content-Type": "application/json" });
let options: any = {
method: method,
headers: HeadersConfig,
redirect: "follow",
credentials: "include",
};
if (data) {
options.body = JSON.stringify(data);
}
return options;
};