From db5ac3317d0b5087b27fcb5812e2349a4ed7f6d8 Mon Sep 17 00:00:00 2001 From: pray4skylark Date: Wed, 30 Sep 2026 18:41:00 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=A7=81=EC=9B=90=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=ED=95=84=20=EC=A1=B0=ED=9A=8C=20=ED=98=B8=EC=B6=9C=20=EB=A9=94?= =?UTF-8?q?=EC=84=9C=EB=93=9C=20=EB=B0=8F=20=EB=B0=B1=EC=97=94=EB=93=9C=20?= =?UTF-8?q?=EC=9D=91=EB=8B=B5=20=EB=B0=94=EC=9D=B8=EB=94=A9=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EB=B3=B4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/(main)/profile/[empId]/page.tsx | 27 +++++++++++++++++-------- src/services/employeeService.ts | 4 ++++ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/app/(main)/profile/[empId]/page.tsx b/src/app/(main)/profile/[empId]/page.tsx index 41cb584..e10e023 100644 --- a/src/app/(main)/profile/[empId]/page.tsx +++ b/src/app/(main)/profile/[empId]/page.tsx @@ -77,24 +77,35 @@ export default function DynamicEmployeeProfilePage() { setError(null); const [empRes, historyRes, contactRes] = await Promise.allSettled([ - employeeService.getById(empId), + employeeService.getOne(empId), employeeService.getDispatchHistories(empId), apiClient.get(`/employees/${empId}/emergency-contacts`), ]); - if (empRes.status === 'fulfilled' && empRes.value?.success) { - setEmployee(empRes.value.data); + if (empRes.status === 'fulfilled' && empRes.value) { + const val = empRes.value as any; + const empData = val.data ?? val; + if (empData && empData.empId) { + setEmployee(empData); + } else { + setError('직원 정보를 찾을 수 없습니다.'); + return; + } } else { setError('직원 정보를 찾을 수 없습니다.'); return; } - if (historyRes.status === 'fulfilled' && historyRes.value?.success) { - setDispatchHistories(Array.isArray(historyRes.value.data) ? historyRes.value.data : []); + if (historyRes.status === 'fulfilled' && historyRes.value) { + const val = historyRes.value as any; + const list = val.data ?? val; + setDispatchHistories(Array.isArray(list) ? list : []); } - if (contactRes.status === 'fulfilled' && contactRes.value?.data) { - setEmergencyContacts(contactRes.value.data); + if (contactRes.status === 'fulfilled' && contactRes.value) { + const val = contactRes.value as any; + const list = val.data ?? val; + setEmergencyContacts(Array.isArray(list) ? list : []); } } catch (err) { console.error(err); @@ -478,7 +489,7 @@ export default function DynamicEmployeeProfilePage() { >

- {dh.projectName || '프로젝트'} + {(dh as any).projectName || (dh as any).project?.projectName || '프로젝트'}

{dh.roleTitle && (

{dh.roleTitle}

diff --git a/src/services/employeeService.ts b/src/services/employeeService.ts index ba23fb6..0e9ce84 100644 --- a/src/services/employeeService.ts +++ b/src/services/employeeService.ts @@ -18,6 +18,10 @@ const employeeService = { return apiClient.get>(`/employees/${empId}`); }, + getById(empId: number) { + return apiClient.get>(`/employees/${empId}`); + }, + getMe() { return apiClient.get>('/employees/me'); },