"use client"; import { useCallback } from "react"; import { useAuth } from "@/hooks/useAuth"; /** * POP 화면 내 경로 조립 훅. * `/COMPANY_7/pop/...` 같은 하드코딩 접두사를 제거하고 로그인 사용자의 회사코드로 동적 조립. * * 사용 예: * const companyPath = usePopCompanyPath(); * router.push(companyPath("/pop/inbound")); // → /COMPANY_50/pop/inbound (COMPANY_50 사용자인 경우) * href={companyPath("/pop/inbound/purchase")} */ export function usePopCompanyPath() { const { companyCode } = useAuth(); return useCallback( (subpath: string) => { const cc = companyCode || ""; const normalized = subpath.startsWith("/") ? subpath : `/${subpath}`; return `/${cc}${normalized}`; }, [companyCode], ); }