From 28bdaedac6428b5b94ea609d1751f3cb02356c9c Mon Sep 17 00:00:00 2001 From: kmh Date: Fri, 24 Apr 2026 15:29:57 +0900 Subject: [PATCH] refactor(pop): extract company path via usePopCompanyPath hook Replace hardcoded /COMPANY_7/ URL prefixes across POP pages and components with usePopCompanyPath() so navigation derives the company code from the authenticated user. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../pop/_components/inbound/ChangeInbound.tsx | 4 ++- .../pop/_components/inbound/ErrorInbound.tsx | 4 ++- .../pop/_components/inbound/InboundCart.tsx | 4 ++- .../_components/inbound/InboundCartPage.tsx | 4 ++- .../pop/_components/inbound/InboundManage.tsx | 4 ++- .../_components/inbound/ProductionInbound.tsx | 4 ++- .../_components/inbound/PurchaseInbound.tsx | 4 ++- .../_components/inbound/RecoveryInbound.tsx | 4 ++- .../inbound/ReturnExternalInbound.tsx | 4 ++- .../inbound/ReturnInternalInbound.tsx | 4 ++- .../inbound/SubcontractorInbound.tsx | 4 ++- .../_components/inbound/SuppliedInbound.tsx | 4 ++- .../pop/_components/outbound/EtcOutbound.tsx | 4 ++- .../_components/outbound/OutboundCartPage.tsx | 4 ++- .../_components/outbound/OutboundManage.tsx | 4 ++- .../outbound/ProductionOutbound.tsx | 4 ++- .../_components/outbound/ReturnOutbound.tsx | 4 ++- .../_components/outbound/SalesOutbound.tsx | 4 ++- .../outbound/SubcontractorOutbound.tsx | 4 ++- .../_components/outbound/SuppliedOutbound.tsx | 4 ++- .../_components/production/WorkOrderList.tsx | 4 ++- .../COMPANY_7/pop/inbound/cart/page.tsx | 4 ++- .../COMPANY_7/pop/inbound/change/page.tsx | 4 ++- .../COMPANY_7/pop/inbound/error/page.tsx | 4 ++- .../app/(main)/COMPANY_7/pop/inbound/page.tsx | 26 ++++++++++--------- .../COMPANY_7/pop/inbound/production/page.tsx | 4 ++- .../COMPANY_7/pop/inbound/purchase/page.tsx | 4 ++- .../COMPANY_7/pop/inbound/recovery/page.tsx | 4 ++- .../pop/inbound/return-external/page.tsx | 4 ++- .../pop/inbound/return-internal/page.tsx | 4 ++- .../pop/inbound/subcontractor/page.tsx | 4 ++- .../COMPANY_7/pop/inbound/supplied/page.tsx | 4 ++- .../app/(main)/COMPANY_7/pop/main/page.tsx | 10 ++++--- .../COMPANY_7/pop/outbound/cart/page.tsx | 4 ++- .../COMPANY_7/pop/outbound/etc/page.tsx | 4 ++- .../(main)/COMPANY_7/pop/outbound/page.tsx | 20 +++++++------- .../pop/outbound/production/page.tsx | 4 ++- .../COMPANY_7/pop/outbound/return/page.tsx | 4 ++- .../COMPANY_7/pop/outbound/sales/page.tsx | 4 ++- .../pop/outbound/subcontractor/page.tsx | 4 ++- .../COMPANY_7/pop/outbound/supplied/page.tsx | 4 ++- .../(main)/COMPANY_7/pop/production/page.tsx | 8 +++--- .../COMPANY_7/pop/production/process/page.tsx | 4 ++- .../pop/production/work/[processId]/page.tsx | 4 ++- frontend/hooks/usePopCompanyPath.ts | 25 ++++++++++++++++++ 45 files changed, 181 insertions(+), 68 deletions(-) create mode 100644 frontend/hooks/usePopCompanyPath.ts diff --git a/frontend/app/(main)/COMPANY_7/pop/_components/inbound/ChangeInbound.tsx b/frontend/app/(main)/COMPANY_7/pop/_components/inbound/ChangeInbound.tsx index de0c5f39..b66cb420 100644 --- a/frontend/app/(main)/COMPANY_7/pop/_components/inbound/ChangeInbound.tsx +++ b/frontend/app/(main)/COMPANY_7/pop/_components/inbound/ChangeInbound.tsx @@ -2,6 +2,7 @@ import React, { useState, useCallback, useEffect, useMemo, useRef } from "react"; import { useRouter } from "next/navigation"; +import { usePopCompanyPath } from "@/hooks/usePopCompanyPath"; import { SupplierModal, type Supplier, matchChosung } from "./SupplierModal"; import { SimpleKeypadModal } from "../common/SimpleKeypadModal"; import { BarcodeScanModal } from "../common/BarcodeScanModal"; @@ -56,6 +57,7 @@ const STORAGE_KEY = "pop_supplier_change"; export function ChangeInbound({ cart, onCartClick, saving, inboundType, sourceTable }: ChangeInboundProps) { const router = useRouter(); + const companyPath = usePopCompanyPath(); /* State */ const [selectedSupplier, setSelectedSupplier] = useState(null); @@ -240,7 +242,7 @@ export function ChangeInbound({ cart, onCartClick, saving, inboundType, sourceTa