29 lines
660 B
TypeScript
29 lines
660 B
TypeScript
"use client";
|
|
|
|
import { BaseLayout } from "@common/components";
|
|
import type { MenuItem } from "./store/common";
|
|
import { useDmStore } from "./store";
|
|
import { usePathname, useRouter } from "next/navigation";
|
|
|
|
export default function Base({
|
|
children,
|
|
}: Readonly<{
|
|
children: React.ReactNode;
|
|
}>) {
|
|
const { getMenuAuth } = useDmStore((state) => state);
|
|
|
|
const router = useRouter();
|
|
const pathname = usePathname();
|
|
|
|
const handleClick = (id: MenuItem) => {
|
|
getMenuAuth(id.menuCd);
|
|
router.push(id.urlPath);
|
|
};
|
|
|
|
return (
|
|
<BaseLayout currentPath={pathname ?? ""} handleMenuClick={handleClick}>
|
|
{children}
|
|
</BaseLayout>
|
|
);
|
|
}
|