show not found error on missing slugs
This commit is contained in:
@ -1,8 +1,9 @@
|
||||
import { graphql } from "@/gql";
|
||||
import { AssociationFragment } 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 { AssociationFragment } from "@/gql/graphql";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
export async function generateStaticParams() {
|
||||
const allAssociationSlugsQuery = graphql(`
|
||||
@ -42,6 +43,10 @@ export default async function Page({ params }: { params: { slug: string } }) {
|
||||
slug: params.slug,
|
||||
});
|
||||
|
||||
if (data?.association === null || error) {
|
||||
return notFound();
|
||||
}
|
||||
|
||||
const association = (data?.association ?? {}) as AssociationFragment;
|
||||
|
||||
return (
|
||||
|
Reference in New Issue
Block a user