37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
"use client";
|
|
import type { MenuItem } from "@common/components/api";
|
|
import { NoFooterLayout } from "@common/components/ui";
|
|
import { useQueryClient } from "@tanstack/react-query";
|
|
import { usePathname,useRouter } from "next/navigation";
|
|
import { useMenuStore } from "@/src/shared/lib";
|
|
import { useWrStore } from "../store";
|
|
import { authService } from "@/src/entities/auth";
|
|
|
|
export default function MapLayout({
|
|
children,
|
|
}: Readonly<{
|
|
children: React.ReactNode;
|
|
}>) {
|
|
const { getMenuAuthrts } = useWrStore((state) => state);
|
|
const setCurrentMenuInfo = useMenuStore((state) => state.setCurrentMenuInfo);
|
|
const router = useRouter();
|
|
const pathname = usePathname();
|
|
const queryClient = useQueryClient();
|
|
|
|
const changeMenu = (path: MenuItem) => {
|
|
setCurrentMenuInfo(path);
|
|
getMenuAuthrts(path.menuCd);
|
|
router.push(path.urlPath);
|
|
};
|
|
return (
|
|
<NoFooterLayout
|
|
queryClient={queryClient}
|
|
authService={authService}
|
|
currentPath={pathname ?? ""}
|
|
handleMenuClick={changeMenu}
|
|
>
|
|
{children}
|
|
</NoFooterLayout>
|
|
);
|
|
}
|