feat: use requests with auth header for home

This commit is contained in:
swve 2023-05-22 16:51:51 +00:00
parent 3457b57c58
commit 9f28dfe7e8
7 changed files with 83 additions and 40 deletions

View file

@ -18,6 +18,20 @@ export const RequestBody = (method: string, data: any, next: any) => {
return options;
};
export const RequestBodyWithAuthHeader = (method: string, data: any, next: any, token: string) => {
let HeadersConfig = new Headers({ Authorization: `Bearer ${token}` });
let options: any = {
method: method,
headers: HeadersConfig,
redirect: "follow",
credentials: "include",
body: data,
// Next.js
next: next,
};
return options;
};
export const RequestBodyForm = (method: string, data: any, next: any) => {
let HeadersConfig = new Headers({});
let options: any = {