From c3e5d7fc1b9c10ca73f25b9fc4a0cf0f5713f0a3 Mon Sep 17 00:00:00 2001 From: johngreen Date: Tue, 12 May 2026 18:10:07 +0900 Subject: [PATCH] =?UTF-8?q?fix(=EB=8C=80=EB=AC=B4=EC=9E=90):=20Select=20?= =?UTF-8?q?=ED=9B=84=EB=B3=B4=20=EB=AA=A9=EB=A1=9D=20-=20getUserList=20?= =?UTF-8?q?=EC=9D=91=EB=8B=B5=20shape=20=ED=98=B8=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SubstituteSection 의 loadCandidates 가 res.data.list 를 가정했지만 getUserList(/api/admin/users) 응답은 { data: [...] } 형태 (data 가 list 자체). 결과로 모든 select 가 '지정 가능한 사용자가 없습니다' 로 표시됐음. Array.isArray(res.data) 와 res.data.list 둘 다 fallback 으로 처리. --- frontend/components/admin/SubstituteSection.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/frontend/components/admin/SubstituteSection.tsx b/frontend/components/admin/SubstituteSection.tsx index adae87b5..7eef75bc 100644 --- a/frontend/components/admin/SubstituteSection.tsx +++ b/frontend/components/admin/SubstituteSection.tsx @@ -78,9 +78,17 @@ export function SubstituteSection({ originalUserId, originalUserName }: Substitu // 대무자 후보 사용자 목록 로드 (다이얼로그 열릴 때 한번) const loadCandidates = useCallback(async () => { setCandidatesLoading(true); - const res = await getUserList({ status: "active", limit: 1000 }); - if (res?.success && Array.isArray(res.data?.list)) { - const filtered = (res.data.list as Record[]).filter( + const res: any = await getUserList({ status: "active", limit: 1000 }); + // user.ts 의 getUserList 는 axios response 의 data 를 반환: + // { success, data: [...], total, ... } (data 가 list 자체) + // 또는 cross-tenant mode 등에서 { data: { list: [...] } } 일 수도 있어 둘 다 지원. + const rawList: any[] = Array.isArray(res?.data) + ? res.data + : Array.isArray(res?.data?.list) + ? res.data.list + : []; + if (rawList.length > 0) { + const filtered = (rawList as Record[]).filter( (u) => u.user_id !== originalUserId && u.user_type !== "SUPER_ADMIN" &&