mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: reformat utility req functions to use next
This commit is contained in:
parent
1f6020efc0
commit
bb0f9166f9
14 changed files with 43 additions and 41 deletions
|
|
@ -1,15 +1,15 @@
|
|||
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context";
|
||||
import { denyAccessToUser } from "../react/middlewares/views";
|
||||
|
||||
export const RequestBody = (method: string, data: any) => {
|
||||
export const RequestBody = (method: string, data: any, next: any) => {
|
||||
let HeadersConfig = new Headers({ "Content-Type": "application/json" });
|
||||
let options: any = {
|
||||
method: method,
|
||||
headers: HeadersConfig,
|
||||
redirect: "follow",
|
||||
credentials: "include",
|
||||
// Next.js
|
||||
cache: 'no-store'
|
||||
// Next.js
|
||||
next: next,
|
||||
};
|
||||
if (data) {
|
||||
options.body = JSON.stringify(data);
|
||||
|
|
@ -17,7 +17,7 @@ export const RequestBody = (method: string, data: any) => {
|
|||
return options;
|
||||
};
|
||||
|
||||
export const RequestBodyForm = (method: string, data: any) => {
|
||||
export const RequestBodyForm = (method: string, data: any, next: any) => {
|
||||
let HeadersConfig = new Headers({});
|
||||
let options: any = {
|
||||
method: method,
|
||||
|
|
@ -25,6 +25,8 @@ export const RequestBodyForm = (method: string, data: any) => {
|
|||
redirect: "follow",
|
||||
credentials: "include",
|
||||
body: data,
|
||||
// Next.js
|
||||
next: next,
|
||||
};
|
||||
return options;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue