Made client/[name] generate static pages
All checks were successful
checks-impure / test (pull_request) Successful in 26s
checks / test (pull_request) Successful in 1m19s

This commit is contained in:
2024-01-23 00:17:24 +01:00
parent d54206f43c
commit 6f4bab98c1
7 changed files with 45 additions and 13 deletions

View File

@@ -0,0 +1,21 @@
import Client from "@/app/client/client";
import { menuEntityEntries } from "@/components/sidebar";
export const dynamic = "error";
export const dynamicParams = false;
/*
The generateStaticParams function can be used in combination with dynamic route segments
to statically generate routes at build time instead of on-demand at request time.
During next dev, generateStaticParams will be called when you navigate to a route.
During next build, generateStaticParams runs before the corresponding Layouts or Pages are generated.
https://nextjs.org/docs/app/api-reference/functions/generate-static-params
*/
export function generateStaticParams() {
return menuEntityEntries.map((entry) => ({
name: entry.label,
}));
}
export default function Page({ params }: { params: { name: string } }) {
return <Client params={params} />;
}

View File

@@ -105,14 +105,10 @@ const AttachButton = ({
);
};
export default function Client({
params,
}: {
params: { client_name: string };
}) {
const { client_name } = params;
export default function Client({ params }: { params: { name: string } }) {
const { name } = params;
const { entity: entity } = useGetEntityByNameOrDid(client_name);
const { entity: entity } = useGetEntityByNameOrDid(name);
const {
data: services,
isLoading: services_loading,