Files
frontend/apps/fo/app/pages/(with-layout)/layout.tsx
T

31 lines
686 B
TypeScript

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