From 5c7a8df55feac36e945cacd4c5dd47e1f030cb74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A7=80=EC=B2=A0?= Date: Sat, 26 Jul 2025 16:07:19 +0900 Subject: [PATCH] =?UTF-8?q?currentPath=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/dm/app/base.tsx | 14 ++++++++++---- apps/fo/app/base.tsx | 15 ++++++++++----- apps/wr/app/base.tsx | 29 +++++++++++++++-------------- 3 files changed, 35 insertions(+), 23 deletions(-) diff --git a/apps/dm/app/base.tsx b/apps/dm/app/base.tsx index 3905c9952..bae02acb2 100644 --- a/apps/dm/app/base.tsx +++ b/apps/dm/app/base.tsx @@ -3,7 +3,7 @@ import { BaseLayout } from "@common/components"; import type { MenuItem } from "./store/common"; import { useDmStore } from "./store"; -import { useRouter } from "next/navigation"; +import { usePathname, useRouter } from "next/navigation"; export default function Base({ children, @@ -13,10 +13,16 @@ export default function Base({ const { getMenuAuth } = useDmStore((state) => state); const router = useRouter(); - const handleClick = (id:MenuItem) =>{ + const pathname = usePathname(); + + const handleClick = (id: MenuItem) => { getMenuAuth(id.menuCd); router.push(id.urlPath); - } + }; - return {children}; + return ( + + {children} + + ); } diff --git a/apps/fo/app/base.tsx b/apps/fo/app/base.tsx index 7bdf4f3e0..a01ce8643 100644 --- a/apps/fo/app/base.tsx +++ b/apps/fo/app/base.tsx @@ -3,7 +3,7 @@ import { BaseLayout } from "@common/components"; import type { MenuItem } from "./store/common"; import { useFoStore } from "./store"; -import { useRouter } from "next/navigation"; +import { usePathname, useRouter } from "next/navigation"; export default function Base({ children, @@ -11,12 +11,17 @@ export default function Base({ children: React.ReactNode; }>) { const { getMenuAuth } = useFoStore((state) => state); - + const pathname = usePathname(); const router = useRouter(); - const handleClick = (id:MenuItem) =>{ + + const handleClick = (id: MenuItem) => { getMenuAuth(id.menuCd); router.push(id.urlPath); - } + }; - return {children}; + return ( + + {children} + + ); } diff --git a/apps/wr/app/base.tsx b/apps/wr/app/base.tsx index 8ffaa42fe..34452e20b 100644 --- a/apps/wr/app/base.tsx +++ b/apps/wr/app/base.tsx @@ -1,24 +1,25 @@ -"use client" -import { BaseLayout } from "@common/components/ui" -import { useWrStore } from "./store" -import { MainDiv } from "@common/business_components/ui" -import type { MenuItem } from "./store/common/type/menu" -import { useRouter } from "next/navigation" +"use client"; +import { BaseLayout } from "@common/components/ui"; +import { useWrStore } from "./store"; +import { MainDiv } from "@common/business_components/ui"; +import type { MenuItem } from "./store/common/type/menu"; +import { usePathname, useRouter } from "next/navigation"; export default function Base({ children, }: Readonly<{ - children: React.ReactNode + children: React.ReactNode; }>) { - const { getMenuAuthrts } = useWrStore((state) => state) - const router = useRouter() + const { getMenuAuthrts } = useWrStore((state) => state); + const router = useRouter(); + const pathname = usePathname(); const changeMenu = (path: MenuItem) => { - getMenuAuthrts(path.menuCd) - router.push(path.urlPath) - } + getMenuAuthrts(path.menuCd); + router.push(path.urlPath); + }; return ( - + {children} - ) + ); }