26 lines
753 B
TypeScript
26 lines
753 B
TypeScript
"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;
|
|
}>) {
|
|
const { getMenuAuthrts } = useWrStore((state) => state);
|
|
const router = useRouter();
|
|
const pathname = usePathname();
|
|
|
|
const changeMenu = (path: MenuItem) => {
|
|
getMenuAuthrts(path.menuCd);
|
|
router.push(path.urlPath);
|
|
};
|
|
return (
|
|
<BaseLayout currentPath={pathname ?? ""} handleMenuClick={changeMenu}>
|
|
<MainDiv>{children}</MainDiv>
|
|
</BaseLayout>
|
|
);
|
|
}
|