mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: use requests with auth header for home
This commit is contained in:
parent
3457b57c58
commit
9f28dfe7e8
7 changed files with 83 additions and 40 deletions
|
|
@ -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 = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue