show not found error on missing slugs

This commit is contained in:
2024-05-23 02:56:23 +02:00
parent ef8b7d05c8
commit 5041cd0bde
4 changed files with 31 additions and 12 deletions

View File

@ -1,8 +1,9 @@
import { graphql } from "@/gql";
import { VenueFragment } from "@/gql/graphql";
import { getClient } from "@/app/client";
import { Blocks } from "@/components/blocks/Blocks";
import Image from "@/components/general/Image";
import { graphql } from "@/gql";
import { VenueFragment } from "@/gql/graphql";
import { notFound } from "next/navigation";
export async function generateStaticParams() {
const allVenueSlugsQuery = graphql(`
@ -39,8 +40,12 @@ export default async function Page({ params }: { params: { slug: string } }) {
slug: params.slug,
});
if (data?.venue === null || error) {
return notFound();
}
const venue = (data?.venue ?? {}) as VenueFragment;
const featuredImage: any = venue.featuredImage
const featuredImage: any = venue.featuredImage;
return (
<main className="site-main" id="main">