mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: use Next.js on demand revalidation
This commit is contained in:
parent
86e4ec64b5
commit
cc6cc52ba5
7 changed files with 39 additions and 10 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context";
|
||||
import { denyAccessToUser } from "../react/middlewares/views";
|
||||
import { LEARNHOUSE_DOMAIN, LEARNHOUSE_HTTP_PROTOCOL } from "@services/config/config";
|
||||
|
||||
export const RequestBody = (method: string, data: any, next: any) => {
|
||||
let HeadersConfig = new Headers({ "Content-Type": "application/json" });
|
||||
|
|
@ -69,3 +70,9 @@ export const errorHandling = (res: any) => {
|
|||
}
|
||||
return res.json();
|
||||
};
|
||||
|
||||
export const revalidateTags = (tags: string[]) => {
|
||||
tags.forEach((tag) => {
|
||||
fetch(`${LEARNHOUSE_HTTP_PROTOCOL}${LEARNHOUSE_DOMAIN}/api/revalidate?tag=${tag}`);
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue