Fixed sidebar and did problem

This commit is contained in:
2024-01-25 14:47:37 +01:00
parent a8b472e84d
commit 170ada9382
5 changed files with 60 additions and 62 deletions

View File

@@ -1,21 +0,0 @@
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

@@ -26,6 +26,7 @@ import useGetEntityByNameOrDid from "@/components/hooks/useGetEntityByNameOrDid"
import { useGetAllServices } from "@/api/services/services";
import axios from "axios";
import CloseIcon from "@mui/icons-material/Close";
import { useSearchParams } from "next/navigation";
interface SnackMessage {
message: string;
@@ -105,8 +106,10 @@ const AttachButton = ({
);
};
export default function Client({ params }: { params: { name: string } }) {
const { name } = params;
export default function Client() {
const searchParams = useSearchParams();
console.log("params: ", searchParams);
const name = searchParams.get("name") ?? "";
const { entity: entity } = useGetEntityByNameOrDid(name);
const {