Fixed the revalidate
This commit is contained in:
parent
5de174d63e
commit
1f01ae3d2b
|
@ -50,7 +50,7 @@ export function PostPage(props: Immutable<Props>): JSX.Element {
|
||||||
const [selectedTranslation, LanguageSwitcher] = useSmartLanguage({
|
const [selectedTranslation, LanguageSwitcher] = useSmartLanguage({
|
||||||
items: post.translations,
|
items: post.translations,
|
||||||
languages: languages,
|
languages: languages,
|
||||||
languageExtractor: (item) => item?.language?.data?.attributes?.code,
|
languageExtractor: (item) => item.language?.data?.attributes?.code,
|
||||||
});
|
});
|
||||||
|
|
||||||
const thumbnail =
|
const thumbnail =
|
||||||
|
|
|
@ -14,7 +14,7 @@ export interface RequestMailProps {
|
||||||
formName: string;
|
formName: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function Mail(
|
export default async function Mail(
|
||||||
req: NextApiRequest,
|
req: NextApiRequest,
|
||||||
res: NextApiResponse<ResponseMailProps>
|
res: NextApiResponse<ResponseMailProps>
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -7,6 +7,7 @@ type RequestProps =
|
||||||
| HookLibraryItem
|
| HookLibraryItem
|
||||||
| HookChronology
|
| HookChronology
|
||||||
| HookContent
|
| HookContent
|
||||||
|
| HookContentGroup
|
||||||
| HookCustom;
|
| HookCustom;
|
||||||
|
|
||||||
type HookRangedContent = {
|
type HookRangedContent = {
|
||||||
|
@ -60,6 +61,16 @@ type HookLibraryItem = {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type HookContentGroup = {
|
||||||
|
event: "entry.update" | "entry.delete" | "entry.create";
|
||||||
|
model: "contents-group";
|
||||||
|
entry: {
|
||||||
|
contents: {
|
||||||
|
slug: string;
|
||||||
|
}[];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
type HookChronology = {
|
type HookChronology = {
|
||||||
event: "entry.update" | "entry.delete" | "entry.create";
|
event: "entry.update" | "entry.delete" | "entry.create";
|
||||||
model: "chronology-era" | "chronology-item";
|
model: "chronology-era" | "chronology-item";
|
||||||
|
@ -70,7 +81,7 @@ type ResponseMailProps = {
|
||||||
revalidated: boolean;
|
revalidated: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function Mail(
|
export default async function Revalidate(
|
||||||
req: NextApiRequest,
|
req: NextApiRequest,
|
||||||
res: NextApiResponse<ResponseMailProps>
|
res: NextApiResponse<ResponseMailProps>
|
||||||
) {
|
) {
|
||||||
|
@ -93,8 +104,8 @@ export async function Mail(
|
||||||
paths.push(`/news`);
|
paths.push(`/news`);
|
||||||
paths.push(`/news/${body.entry.slug}`);
|
paths.push(`/news/${body.entry.slug}`);
|
||||||
serverRuntimeConfig.locales?.map((locale: string) => {
|
serverRuntimeConfig.locales?.map((locale: string) => {
|
||||||
paths.push(`/${locale}/news/${body.entry.slug}`);
|
|
||||||
paths.push(`/${locale}/news`);
|
paths.push(`/${locale}/news`);
|
||||||
|
paths.push(`/${locale}/news/${body.entry.slug}`);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -103,24 +114,26 @@ export async function Mail(
|
||||||
paths.push(`/library`);
|
paths.push(`/library`);
|
||||||
paths.push(`/library/${body.entry.slug}`);
|
paths.push(`/library/${body.entry.slug}`);
|
||||||
paths.push(`/library/${body.entry.slug}/scans`);
|
paths.push(`/library/${body.entry.slug}/scans`);
|
||||||
|
body.entry.subitem_of.map((parentItem) => {
|
||||||
|
paths.push(`/library/${parentItem.slug}`);
|
||||||
|
});
|
||||||
serverRuntimeConfig.locales?.map((locale: string) => {
|
serverRuntimeConfig.locales?.map((locale: string) => {
|
||||||
|
paths.push(`/${locale}/library`);
|
||||||
paths.push(`/${locale}/library/${body.entry.slug}`);
|
paths.push(`/${locale}/library/${body.entry.slug}`);
|
||||||
paths.push(`/${locale}/library/${body.entry.slug}/scans`);
|
paths.push(`/${locale}/library/${body.entry.slug}/scans`);
|
||||||
body.entry.subitem_of.map((parentItem) => {
|
body.entry.subitem_of.map((parentItem) => {
|
||||||
paths.push(`/${locale}/library/${parentItem.slug}`);
|
paths.push(`/${locale}/library/${parentItem.slug}`);
|
||||||
});
|
});
|
||||||
paths.push(`/${locale}/library`);
|
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case "content": {
|
case "content": {
|
||||||
console.log(body.entry.ranged_contents);
|
|
||||||
paths.push(`/contents`);
|
paths.push(`/contents`);
|
||||||
paths.push(`/contents/${body.entry.slug}`);
|
paths.push(`/contents/${body.entry.slug}`);
|
||||||
serverRuntimeConfig.locales?.map((locale: string) => {
|
serverRuntimeConfig.locales?.map((locale: string) => {
|
||||||
paths.push(`/${locale}/contents/${body.entry.slug}`);
|
|
||||||
paths.push(`/${locale}/contents`);
|
paths.push(`/${locale}/contents`);
|
||||||
|
paths.push(`/${locale}/contents/${body.entry.slug}`);
|
||||||
});
|
});
|
||||||
if (body.entry.ranged_contents.length > 0) {
|
if (body.entry.ranged_contents.length > 0) {
|
||||||
body.entry.ranged_contents.map((ranged_content) => {
|
body.entry.ranged_contents.map((ranged_content) => {
|
||||||
|
@ -164,16 +177,27 @@ export async function Mail(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case "contents-group": {
|
||||||
|
paths.push(`/contents`);
|
||||||
|
serverRuntimeConfig.locales?.map((locale: string) => {
|
||||||
|
paths.push(`/${locale}/contents`);
|
||||||
|
});
|
||||||
|
body.entry.contents.map((content) => {
|
||||||
|
paths.push(`/contents/${content.slug}`);
|
||||||
|
serverRuntimeConfig.locales?.map((locale: string) => {
|
||||||
|
paths.push(`/${locale}/contents/${content.slug}`);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case "custom": {
|
case "custom": {
|
||||||
paths.push(`${body.url}`);
|
paths.push(`${body.url}`);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case "content": {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
console.log(body);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue