mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
14 lines
344 B
TypeScript
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;
|
|
};
|
|
|