diff --git a/citrus/app/(organizers)/organizer/dashboard/[id]/page.tsx b/citrus/app/(organizers)/organizer/dashboard/[id]/page.tsx new file mode 100644 index 0000000..1c1965b --- /dev/null +++ b/citrus/app/(organizers)/organizer/dashboard/[id]/page.tsx @@ -0,0 +1,13 @@ +import EditEvent from "@/components/EditEvent"; +import { getServerSession } from "next-auth"; +import { authOptions } from "@/app/api/auth/[...nextauth]/route"; + +export default async function Page( {params}: { params: {id: string }}) { + const session = await getServerSession(authOptions); + const res = await fetch(process.env.BASE_API_URL + 'api/experiences/' + params.id); + const experience = await res.json(); + if (experience.org_id !== session?.user?.name) { + return

You are not authorized to edit this event.

+ } + return +} \ No newline at end of file diff --git a/citrus/components/EventCard.tsx b/citrus/components/EventCard.tsx index 4509916..1748ab8 100644 --- a/citrus/components/EventCard.tsx +++ b/citrus/components/EventCard.tsx @@ -15,7 +15,7 @@ function deleteOnClick(eventID: string) { } function ManagementTools({ eventID, isUser }: { eventID: string, isUser: boolean }) { - const manageLink = (isUser) ? "/edit/" + eventID : "/organizer/dashboard" + eventID; + const manageLink = (isUser) ? "/edit/" + eventID : "/organizer/dashboard/" + eventID; return (