Fixed 500 errors throughout the app
This commit is contained in:
parent
2dee361f20
commit
3f7cad9053
|
@ -18,7 +18,7 @@ export function getPostStaticProps(
|
||||||
slug: slug,
|
slug: slug,
|
||||||
language_code: context.locale ?? "en",
|
language_code: context.locale ?? "en",
|
||||||
});
|
});
|
||||||
if (post.posts?.data[0].attributes?.translations) {
|
if (post.posts?.data[0]?.attributes?.translations) {
|
||||||
const props: PostStaticProps = {
|
const props: PostStaticProps = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
post: post.posts.data[0].attributes as PostWithTranslations,
|
post: post.posts.data[0].attributes as PostWithTranslations,
|
||||||
|
|
|
@ -192,7 +192,7 @@ export async function getStaticProps(
|
||||||
const videos = await sdk.getVideo({
|
const videos = await sdk.getVideo({
|
||||||
uid: context.params?.uid ? context.params.uid.toString() : "",
|
uid: context.params?.uid ? context.params.uid.toString() : "",
|
||||||
});
|
});
|
||||||
if (!videos.videos?.data[0].attributes) return { notFound: true };
|
if (!videos.videos?.data[0]?.attributes) return { notFound: true };
|
||||||
const props: Props = {
|
const props: Props = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
video: videos.videos.data[0].attributes,
|
video: videos.videos.data[0].attributes,
|
||||||
|
|
|
@ -361,7 +361,7 @@ export async function getStaticProps(
|
||||||
language_code: context.locale ?? "en",
|
language_code: context.locale ?? "en",
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!content.contents || !content.contents.data[0].attributes?.translations) {
|
if (!content.contents || !content.contents.data[0]?.attributes?.translations) {
|
||||||
return { notFound: true };
|
return { notFound: true };
|
||||||
}
|
}
|
||||||
const props: Props = {
|
const props: Props = {
|
||||||
|
|
|
@ -126,7 +126,7 @@ export async function getStaticProps(
|
||||||
slug: context.params?.slug ? context.params.slug.toString() : "",
|
slug: context.params?.slug ? context.params.slug.toString() : "",
|
||||||
language_code: context.locale ?? "en",
|
language_code: context.locale ?? "en",
|
||||||
});
|
});
|
||||||
if (!item.libraryItems) return { notFound: true };
|
if (!item.libraryItems?.data[0]?.attributes) return { notFound: true };
|
||||||
const props: Props = {
|
const props: Props = {
|
||||||
...(await getAppStaticProps(context)),
|
...(await getAppStaticProps(context)),
|
||||||
item: item.libraryItems.data[0].attributes,
|
item: item.libraryItems.data[0].attributes,
|
||||||
|
|
Loading…
Reference in New Issue