refactor: 'SITE_ID' 환경변수 쿠키로 수정

This commit is contained in:
2025-06-30 13:23:29 +09:00
parent 0e9d865f44
commit 9a38ce33c0
6 changed files with 15 additions and 10 deletions
@@ -4,10 +4,11 @@ import { useEffect } from "react";
import { usePathname, useRouter } from "next/navigation";
import { MenuAuthorityApi } from "@/entities/menu-authority/@x/menu";
import { getCookie, useAlertStore, useMenuStore } from "@/shared/lib";
import { SITE_ID } from "@/shared/config";
import { MenuApi } from "../api/menu-service";
import { getCurrentMenu } from "./utils";
const siteId = getCookie("site-id-key") ?? "";
const MenuWrapper = ({ children }: { children: React.ReactNode }) => {
const router = useRouter();
const pathname = usePathname();
@@ -17,7 +18,7 @@ const MenuWrapper = ({ children }: { children: React.ReactNode }) => {
useMenuStore((state) => state);
const getCurrentMenuInfo = async () => {
const menuRoles = await MenuApi.getMenuRoles(SITE_ID);
const menuRoles = await MenuApi.getMenuRoles(siteId);
if (!menuRoles) return;
return getCurrentMenu(menuRoles, pathname ?? "");
};