show not found error on missing slugs
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { graphql } from "@/gql";
|
||||
import { EventFragment } from "@/gql/graphql";
|
||||
import { getClient } from "@/app/client";
|
||||
import { Blocks } from "@/components/blocks/Blocks";
|
||||
import Image from "@/components/general/Image";
|
||||
import { EventHeader } from "@/components/events/EventHeader";
|
||||
import { DateList } from "@/components/events/DateList";
|
||||
import { EventHeader } from "@/components/events/EventHeader";
|
||||
import { BgPig } from "@/components/general/BgPig";
|
||||
import { graphql } from "@/gql";
|
||||
import { EventFragment } from "@/gql/graphql";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
export async function generateStaticParams() {
|
||||
const allEventSlugsQuery = graphql(`
|
||||
@@ -42,6 +42,10 @@ export default async function Page({ params }: { params: { slug: string } }) {
|
||||
slug: params.slug,
|
||||
});
|
||||
|
||||
if (data?.event === null || error) {
|
||||
return notFound();
|
||||
}
|
||||
|
||||
const event = (data?.event ?? {}) as EventFragment;
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user