하수재이용 수정
iipbs_wr / build (push) Waiting to run

This commit is contained in:
leedj312
2025-07-06 00:46:43 +09:00
parent 0d13f5eac6
commit 7d56ba0243
4 changed files with 68 additions and 63 deletions
@@ -42,6 +42,8 @@ export function PbnstRegModal({
const [currentTab, setCurrentTab] = useState<string>("mng");
const [indexMng, setIndexMng] = useState<number>(0);
const [indexBiz, setIndexBiz] = useState<number>(0);
const onSubmit = async (valuse: { items: PbnstRegArrrayType }) => {
const item = valuse.items[indexMng];
const data = item ? writeRgtrAndMdfr([item]) : [];
@@ -53,6 +55,8 @@ export function PbnstRegModal({
errors: FieldErrors<{ items: z.infer<typeof pbnstRegZod>[] }>
) => {
// 재귀 함수를 사용해 중첩된 에러 객체에서 모든 에러 메시지와 경로를 찾습니다.
const findAllErrors = (
errorObject: any,
path: (string | number)[] = []
@@ -72,13 +76,18 @@ export function PbnstRegModal({
return [];
});
};
const errorList = findAllErrors(errors);
if (errorList.length > 0) {
errorList.forEach((errorInfo) => {
const { message, path } = errorInfo;
let prefix = "";
const itemsIndex = path.indexOf("items");
if (itemsIndex > -1 && path.length > itemsIndex + 1) {
const itemIdx = path[itemsIndex + 1] as number;
const facilityName = form.getValues(
@@ -99,6 +108,8 @@ export function PbnstRegModal({
}
}
}
toast.error(`${prefix}${message}`);
});
}