fix some build errors
This commit is contained in:
@ -33,12 +33,16 @@ export async function generateStaticParams() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
const { data } = await getClient().query(allGenericSlugsQuery, {});
|
const { data, error } = await getClient().query(allGenericSlugsQuery, {});
|
||||||
|
|
||||||
|
if (data === undefined || error) {
|
||||||
|
throw new Error("failed to generate static params");
|
||||||
|
}
|
||||||
|
|
||||||
return data?.pages.map((page: any) => {
|
return data?.pages.map((page: any) => {
|
||||||
// wagtail-grapple prepends the home page slug to the full path on multisite setups
|
// wagtail-grapple prepends the home page slug to the full path on multisite setups
|
||||||
// we also strip the trailing slash
|
// we also strip the trailing slash
|
||||||
const urlPath = page.urlPath
|
const urlPath: string[] = page.urlPath
|
||||||
.replace(/\/home\//, "")
|
.replace(/\/home\//, "")
|
||||||
.replace(/\/$/, "")
|
.replace(/\/$/, "")
|
||||||
.split("/");
|
.split("/");
|
||||||
@ -67,7 +71,7 @@ export default async function Page({ params }: { params: { url: string[] } }) {
|
|||||||
urlPath: urlPath,
|
urlPath: urlPath,
|
||||||
});
|
});
|
||||||
|
|
||||||
const page = (data?.page ?? []) as GenericFragment[];
|
const page = (data?.page ?? []) as GenericFragment;
|
||||||
|
|
||||||
if (!page) {
|
if (!page) {
|
||||||
return notFound();
|
return notFound();
|
||||||
|
@ -14,7 +14,11 @@ export async function generateStaticParams() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
const { data } = await getClient().query(allEventSlugsQuery);
|
const { data, error } = await getClient().query(allEventSlugsQuery, {});
|
||||||
|
|
||||||
|
if (data === undefined || error) {
|
||||||
|
throw new Error("failed to generate static params");
|
||||||
|
}
|
||||||
|
|
||||||
return data?.pages.map((page: any) => ({
|
return data?.pages.map((page: any) => ({
|
||||||
slug: page.slug,
|
slug: page.slug,
|
||||||
|
@ -13,7 +13,11 @@ export async function generateStaticParams() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
const { data } = await getClient().query(allVenueSlugsQuery);
|
const { data, error } = await getClient().query(allVenueSlugsQuery, {});
|
||||||
|
|
||||||
|
if (data === undefined || error) {
|
||||||
|
throw new Error("failed to generate static params");
|
||||||
|
}
|
||||||
|
|
||||||
return data?.pages.map((page: any) => ({
|
return data?.pages.map((page: any) => ({
|
||||||
slug: page.slug,
|
slug: page.slug,
|
||||||
|
Reference in New Issue
Block a user