Added fallback and avoid 404
This commit is contained in:
parent
4dd1782389
commit
935c364a71
|
@ -26,7 +26,7 @@ export default function FourOhFour(props: FourOhFourProps): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ props: FourOhFourProps }> {
|
): Promise<{ notFound: boolean } | { props: FourOhFourProps }> {
|
||||||
const props: FourOhFourProps = {
|
const props: FourOhFourProps = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
import AppLayout from "components/AppLayout";
|
||||||
|
import ReturnButton, {
|
||||||
|
ReturnButtonType,
|
||||||
|
} from "components/PanelComponents/ReturnButton";
|
||||||
|
import ContentPanel from "components/Panels/ContentPanel";
|
||||||
|
import { GetStaticPropsContext } from "next";
|
||||||
|
import { AppStaticProps, getAppStaticProps } from "queries/getAppStaticProps";
|
||||||
|
|
||||||
|
interface FiveHundredProps extends AppStaticProps {}
|
||||||
|
|
||||||
|
export default function FiveHundred(props: FiveHundredProps): JSX.Element {
|
||||||
|
const { langui } = props;
|
||||||
|
const contentPanel = (
|
||||||
|
<ContentPanel>
|
||||||
|
<h1>500 - Internal Server Error</h1>
|
||||||
|
<ReturnButton
|
||||||
|
href="/"
|
||||||
|
title="Home"
|
||||||
|
langui={langui}
|
||||||
|
displayOn={ReturnButtonType.both}
|
||||||
|
/>
|
||||||
|
</ContentPanel>
|
||||||
|
);
|
||||||
|
return <AppLayout navTitle="500" contentPanel={contentPanel} {...props} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getStaticProps(
|
||||||
|
context: GetStaticPropsContext
|
||||||
|
): Promise<{ notFound: boolean } | { props: FiveHundredProps }> {
|
||||||
|
const props: FiveHundredProps = {
|
||||||
|
...(await getAppStaticProps(context)),
|
||||||
|
};
|
||||||
|
return {
|
||||||
|
props: props,
|
||||||
|
};
|
||||||
|
}
|
|
@ -80,7 +80,7 @@ export default function AccordsHandbook(
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ props: AccordsHandbookProps }> {
|
): Promise<{ notFound: boolean } | { props: AccordsHandbookProps }> {
|
||||||
const slug = "accords-handbook";
|
const slug = "accords-handbook";
|
||||||
const props: AccordsHandbookProps = {
|
const props: AccordsHandbookProps = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
|
|
|
@ -224,7 +224,7 @@ export default function AboutUs(props: ContactProps): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ props: ContactProps }> {
|
): Promise<{ notFound: boolean } | { props: ContactProps }> {
|
||||||
const slug = "contact";
|
const slug = "contact";
|
||||||
const props: ContactProps = {
|
const props: ContactProps = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
|
|
|
@ -38,7 +38,7 @@ export default function AboutUs(props: AboutUsProps): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ props: AboutUsProps }> {
|
): Promise<{ notFound: boolean } | { props: AboutUsProps }> {
|
||||||
const props: AboutUsProps = {
|
const props: AboutUsProps = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
};
|
};
|
||||||
|
|
|
@ -78,7 +78,7 @@ export default function SiteInformation(props: SiteInfoProps): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ props: SiteInfoProps }> {
|
): Promise<{ notFound: boolean } | { props: SiteInfoProps }> {
|
||||||
const slug = "legality";
|
const slug = "legality";
|
||||||
const props: SiteInfoProps = {
|
const props: SiteInfoProps = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
|
|
|
@ -78,7 +78,7 @@ export default function SharingPolicy(props: SharingPolicyProps): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ props: SharingPolicyProps }> {
|
): Promise<{ notFound: boolean } | { props: SharingPolicyProps }> {
|
||||||
const slug = "sharing-policy";
|
const slug = "sharing-policy";
|
||||||
const props: SharingPolicyProps = {
|
const props: SharingPolicyProps = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
|
|
|
@ -24,7 +24,7 @@ export default function Archives(props: ArchivesProps): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ props: ArchivesProps }> {
|
): Promise<{ notFound: boolean } | { props: ArchivesProps }> {
|
||||||
const props: ArchivesProps = {
|
const props: ArchivesProps = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,9 +22,9 @@ export default function Chronicles(props: ChroniclesProps): JSX.Element {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getStaticProps(context: GetStaticPropsContext): Promise<{
|
export async function getStaticProps(
|
||||||
props: ChroniclesProps;
|
context: GetStaticPropsContext
|
||||||
}> {
|
): Promise<{ notFound: boolean } | { props: ChroniclesProps }> {
|
||||||
const props: ChroniclesProps = {
|
const props: ChroniclesProps = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
};
|
};
|
||||||
|
|
|
@ -134,17 +134,19 @@ export default function ContentIndex(props: ContentIndexProps): JSX.Element {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getStaticProps(context: GetStaticPropsContext): Promise<{
|
export async function getStaticProps(
|
||||||
props: ContentIndexProps;
|
context: GetStaticPropsContext
|
||||||
}> {
|
): Promise<{ notFound: boolean } | { props: ContentIndexProps }> {
|
||||||
|
const content = (
|
||||||
|
await getContent({
|
||||||
|
slug: context.params?.slug?.toString() ?? "",
|
||||||
|
language_code: context.locale ?? "en",
|
||||||
|
})
|
||||||
|
).contents.data[0].attributes;
|
||||||
|
if (!content) return { notFound: true };
|
||||||
const props: ContentIndexProps = {
|
const props: ContentIndexProps = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
content: (
|
content: content,
|
||||||
await getContent({
|
|
||||||
slug: context.params?.slug?.toString() ?? "",
|
|
||||||
language_code: context.locale ?? "en",
|
|
||||||
})
|
|
||||||
).contents.data[0].attributes,
|
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
props: props,
|
props: props,
|
||||||
|
|
|
@ -246,7 +246,7 @@ export default function ContentRead(props: ContentReadProps): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ props: ContentReadProps }> {
|
): Promise<{ notFound: boolean } | { props: ContentReadProps }> {
|
||||||
const slug = context.params?.slug?.toString() ?? "";
|
const slug = context.params?.slug?.toString() ?? "";
|
||||||
const content = (
|
const content = (
|
||||||
await getContentText({
|
await getContentText({
|
||||||
|
@ -254,6 +254,7 @@ export async function getStaticProps(
|
||||||
language_code: context.locale ?? "en",
|
language_code: context.locale ?? "en",
|
||||||
})
|
})
|
||||||
).contents.data[0];
|
).contents.data[0];
|
||||||
|
if (!content) return { notFound: true };
|
||||||
const props: ContentReadProps = {
|
const props: ContentReadProps = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
content: content.attributes,
|
content: content.attributes,
|
||||||
|
|
|
@ -101,7 +101,7 @@ export default function Contents(props: ContentsProps): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ props: ContentsProps }> {
|
): Promise<{ notFound: boolean } | { props: ContentsProps }> {
|
||||||
const contents = (
|
const contents = (
|
||||||
await getContents({
|
await getContents({
|
||||||
language_code: context.locale ?? "en",
|
language_code: context.locale ?? "en",
|
||||||
|
|
|
@ -91,7 +91,7 @@ export default function Editor(props: EditorProps): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ props: EditorProps }> {
|
): Promise<{ notFound: boolean } | { props: EditorProps }> {
|
||||||
const props: EditorProps = {
|
const props: EditorProps = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
};
|
};
|
||||||
|
|
|
@ -24,7 +24,7 @@ export default function Gallery(props: GalleryProps): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ props: GalleryProps }> {
|
): Promise<{ notFound: boolean } | { props: GalleryProps }> {
|
||||||
const props: GalleryProps = {
|
const props: GalleryProps = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
};
|
};
|
||||||
|
|
|
@ -54,7 +54,7 @@ export default function Home(props: HomeProps): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ props: HomeProps }> {
|
): Promise<{ notFound: boolean } | { props: HomeProps }> {
|
||||||
const slug = "home";
|
const slug = "home";
|
||||||
const props: HomeProps = {
|
const props: HomeProps = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
|
|
|
@ -416,13 +416,14 @@ export default function LibrarySlug(props: LibrarySlugProps): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ props: LibrarySlugProps }> {
|
): Promise<{ notFound: boolean } | { props: LibrarySlugProps }> {
|
||||||
const item = (
|
const item = (
|
||||||
await getLibraryItem({
|
await getLibraryItem({
|
||||||
slug: context.params?.slug?.toString() ?? "",
|
slug: context.params?.slug?.toString() ?? "",
|
||||||
language_code: context.locale ?? "en",
|
language_code: context.locale ?? "en",
|
||||||
})
|
})
|
||||||
).libraryItems.data[0];
|
).libraryItems.data[0];
|
||||||
|
if (!item) return { notFound: true };
|
||||||
const props: LibrarySlugProps = {
|
const props: LibrarySlugProps = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
item: item.attributes,
|
item: item.attributes,
|
||||||
|
|
|
@ -146,13 +146,14 @@ export default function LibrarySlug(props: Props): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ props: Props }> {
|
): Promise<{ notFound: boolean } | { props: Props }> {
|
||||||
const item = (
|
const item = (
|
||||||
await getLibraryItemScans({
|
await getLibraryItemScans({
|
||||||
slug: context.params?.slug?.toString() ?? "",
|
slug: context.params?.slug?.toString() ?? "",
|
||||||
language_code: context.locale ?? "en",
|
language_code: context.locale ?? "en",
|
||||||
})
|
})
|
||||||
).libraryItems.data[0];
|
).libraryItems.data[0];
|
||||||
|
if (!item) return { notFound: true };
|
||||||
const props: Props = {
|
const props: Props = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
item: item.attributes,
|
item: item.attributes,
|
||||||
|
|
|
@ -167,7 +167,7 @@ export default function Library(props: LibraryProps): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ props: LibraryProps }> {
|
): Promise<{ notFound: boolean } | { props: LibraryProps }> {
|
||||||
const props: LibraryProps = {
|
const props: LibraryProps = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
items: (
|
items: (
|
||||||
|
|
|
@ -22,7 +22,7 @@ export default function Merch(props: MerchProps): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ props: MerchProps }> {
|
): Promise<{ notFound: boolean } | { props: MerchProps }> {
|
||||||
const props: MerchProps = {
|
const props: MerchProps = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
};
|
};
|
||||||
|
|
|
@ -146,7 +146,7 @@ export default function LibrarySlug(props: PostProps): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ props: PostProps }> {
|
): Promise<{ notFound: boolean } | { props: PostProps }> {
|
||||||
const slug = context.params?.slug?.toString() ?? "";
|
const slug = context.params?.slug?.toString() ?? "";
|
||||||
const post = (
|
const post = (
|
||||||
await getPost({
|
await getPost({
|
||||||
|
@ -154,6 +154,7 @@ export async function getStaticProps(
|
||||||
language_code: context.locale ?? "en",
|
language_code: context.locale ?? "en",
|
||||||
})
|
})
|
||||||
).posts.data[0];
|
).posts.data[0];
|
||||||
|
if (!post) return { notFound: true };
|
||||||
const props: PostProps = {
|
const props: PostProps = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
post: post.attributes,
|
post: post.attributes,
|
||||||
|
|
|
@ -60,7 +60,7 @@ export default function News(props: NewsProps): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ props: NewsProps }> {
|
): Promise<{ notFound: boolean } | { props: NewsProps }> {
|
||||||
const props: NewsProps = {
|
const props: NewsProps = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
posts: await (
|
posts: await (
|
||||||
|
|
|
@ -143,7 +143,7 @@ export default function Chronology(props: ChronologyProps): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ props: ChronologyProps }> {
|
): Promise<{ notFound: boolean } | { props: ChronologyProps }> {
|
||||||
const props: ChronologyProps = {
|
const props: ChronologyProps = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
chronologyItems: (
|
chronologyItems: (
|
||||||
|
|
|
@ -25,7 +25,7 @@ export default function Wiki(props: WikiProps): JSX.Element {
|
||||||
|
|
||||||
export async function getStaticProps(
|
export async function getStaticProps(
|
||||||
context: GetStaticPropsContext
|
context: GetStaticPropsContext
|
||||||
): Promise<{ props: WikiProps }> {
|
): Promise<{ notFound: boolean } | { props: WikiProps }> {
|
||||||
const props: WikiProps = {
|
const props: WikiProps = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue