diff --git a/front/components/UI/Elements/Menu.tsx b/front/components/UI/Elements/Menu.tsx index facbe583..f55fa596 100644 --- a/front/components/UI/Elements/Menu.tsx +++ b/front/components/UI/Elements/Menu.tsx @@ -6,10 +6,15 @@ import learnhouseIcon from "public/learnhouse_icon.png"; import learnhouseLogo from "public/learnhouse_logo.png"; import Link from "next/link"; import Image from "next/image"; -import { useRouter, useSearchParams } from "next/navigation"; +import { useRouter, useSearchParams, usePathname } from "next/navigation"; import { headers } from "next/headers"; +import { getOrgFromUri, getUriWithOrg } from "@services/config"; -export const Menu = ({ orgslug }: any) => { +export const Menu = (params : any) => { + const router = useRouter(); + const pathname = usePathname(); + const orgslug = getOrgFromUri(pathname); + return ( @@ -29,14 +34,14 @@ export const Menu = ({ orgslug }: any) => {
  • - Courses + Courses
  • - Collections + Collections
  • {" "} - Activity + Activity
  • More
diff --git a/front/services/config.ts b/front/services/config.ts index 7b486965..bd433312 100644 --- a/front/services/config.ts +++ b/front/services/config.ts @@ -4,3 +4,12 @@ const LEARNHOUSE_BACKEND_URL = "http://localhost:1338/"; export const getAPIUrl = () => LEARNHOUSE_API_URL; export const getBackendUrl = () => LEARNHOUSE_BACKEND_URL; + +export const getUriWithOrg = ( orgslug: string, path: string) => { + return `http://localhost:3000/org/${orgslug}${path}`; +}; + +export const getOrgFromUri = (uri: any) => { + let org = uri.match(/\/org\/(.*?)\//)[1]; + return org; +};