Added wiki pages to revalidate

This commit is contained in:
DrMint 2022-07-03 15:02:09 +02:00
parent be1a32181e
commit 18186f2014
1 changed files with 21 additions and 1 deletions

View File

@ -8,7 +8,8 @@ type RequestProps =
| HookChronology | HookChronology
| HookContent | HookContent
| HookContentGroup | HookContentGroup
| HookCustom; | HookCustom
| HookWiki;
type HookRangedContent = { type HookRangedContent = {
event: "entry.update" | "entry.delete" | "entry.create"; event: "entry.update" | "entry.delete" | "entry.create";
@ -76,6 +77,14 @@ type HookChronology = {
model: "chronology-era" | "chronology-item"; model: "chronology-era" | "chronology-item";
}; };
type HookWiki = {
event: "entry.update" | "entry.delete" | "entry.create";
model: "wiki-page";
entry: {
slug: string;
};
};
type ResponseMailProps = { type ResponseMailProps = {
message: string; message: string;
revalidated: boolean; revalidated: boolean;
@ -191,6 +200,17 @@ const Revalidate = async (
break; break;
} }
case "wiki-page": {
paths.push(`/wiki`);
paths.push(`/wiki/${body.entry.slug}`);
serverRuntimeConfig.locales?.map((locale: string) => {
paths.push(`/${locale}/wiki`);
paths.push(`/${locale}/wiki/${body.entry.slug}`);
});
break;
}
case "custom": { case "custom": {
paths.push(`${body.url}`); paths.push(`${body.url}`);
break; break;