From a83cb2709cdf42ccbc9831b6bb8649184fa3b9f0 Mon Sep 17 00:00:00 2001 From: leedj312 Date: Thu, 26 Jun 2025 16:18:52 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9E=85=EB=A0=A5=20=EB=B0=B8=EB=A5=98?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=EC=85=98=EC=9D=98=20=EC=9E=AC=EC=9D=B4?= =?UTF-8?q?=EC=9A=A9=20=EC=8B=9C=EC=84=A4=EB=AA=85=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ruseFcltMng/fcltReg/pbnstReg/page.tsx | 31 ++++++++++--------- .../store/prfmncReg/pbnstPrfmncReg/index.tsx | 1 - 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx index acc72ea0f..6b45dacc9 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx @@ -111,43 +111,46 @@ export default function PublicReuseFaciltyInsert() { const findAllErrors = ( errorObject: any, path: (string | number)[] = [] - ): { message: string; path: (string | number)[] }[] => { + ): { message: string; path: (string | number)[]; }[] => { if (!errorObject) return []; return Object.keys(errorObject).flatMap((key) => { const value = errorObject[key]; const currentKey = !isNaN(parseInt(key)) ? parseInt(key) : key; const newPath = [...path, currentKey]; - if (value && typeof value === "object") { if (typeof value.message === "string") { - return [{ message: value.message, path: newPath }]; + return [{ message: value.message, path: newPath }]; // 에러 메시지와 경로 반환 } return findAllErrors(value, newPath); } return []; }); }; - const errorList = findAllErrors(errors); - if (errorList.length > 0) { errorList.forEach((errorInfo) => { const { message, path } = errorInfo; - let finalMessage = message; - + let prefix = ""; const itemsIndex = path.indexOf("items"); - const fcBizsIndex = path.indexOf("fcBizs"); - if (itemsIndex > -1 && fcBizsIndex > -1 && path.length > fcBizsIndex + 1) { + if (itemsIndex > -1 && path.length > itemsIndex + 1) { const itemIdx = path[itemsIndex + 1] as number; - const bizIdx = path[fcBizsIndex + 1] as number; - const cycle = form.getValues(`items.${itemIdx}.fcBizs.${bizIdx}.cycl`); - if (cycle) { - finalMessage = `[${cycle}차수] ${message}`; + const facilityName = form.getValues(`items.${itemIdx}.ruseUtztnFcltNm`); + if (facilityName) { + prefix += `[${facilityName}] `; + } + + const fcBizsIndex = path.indexOf("fcBizs"); + if (fcBizsIndex > -1 && path.length > fcBizsIndex + 1) { + const bizIdx = path[fcBizsIndex + 1] as number; + const cycle = form.getValues(`items.${itemIdx}.fcBizs.${bizIdx}.cycl`); + if (cycle) { + prefix += `[${cycle}차수] `; + } } } - toast.error(finalMessage); + toast.error(`${prefix}${message}`); }); } }; diff --git a/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/index.tsx b/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/index.tsx index 87e827f60..82f2ed59c 100644 --- a/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/index.tsx +++ b/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/index.tsx @@ -77,7 +77,6 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = ( prfmncHasuInit: async (page: string, sggOrCity: string) => { try { const prfmncRes = await hasuListFetch(page, sggOrCity); - console.log("prfmncRes", prfmncRes); return set((state: pbnstPrfmncState) => ({ ...state, prfmnc: {