From 4ba16fcc365daa905235144eddcd01761a5f6b7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=A7=84=ED=98=B8?= Date: Thu, 8 Aug 2024 10:38:41 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EC=97=90=EB=9F=AC=EB=A9=94?= =?UTF-8?q?=EC=8B=9C=EC=A7=80=20=EC=83=81=EC=88=98=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/constants/errorMessage.ts | 1 + .../usePutAndDeleteBillAction/usePutAndDeleteBillAction.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/client/src/constants/errorMessage.ts b/client/src/constants/errorMessage.ts index e37220f7f..9758f3524 100644 --- a/client/src/constants/errorMessage.ts +++ b/client/src/constants/errorMessage.ts @@ -3,6 +3,7 @@ const ERROR_MESSAGE = { memberName: '참여자 이름은 8자 이하의 한글, 영어만 가능해요', purchasePrice: '10,000,000원 이하의 숫자만 입력이 가능해요', purchaseTitle: '지출 이름은 30자 이하의 한글, 영어, 숫자만 가능해요', + preventEmpty: '값은 비어있을 수 없어요', }; export default ERROR_MESSAGE; diff --git a/client/src/hooks/usePutAndDeleteBillAction/usePutAndDeleteBillAction.ts b/client/src/hooks/usePutAndDeleteBillAction/usePutAndDeleteBillAction.ts index 3e35dab76..50052e08d 100644 --- a/client/src/hooks/usePutAndDeleteBillAction/usePutAndDeleteBillAction.ts +++ b/client/src/hooks/usePutAndDeleteBillAction/usePutAndDeleteBillAction.ts @@ -9,6 +9,8 @@ import {useStepList} from '@hooks/useStepList/useStepList'; import {BillInputType, InputPair} from '@hooks/useDynamicBillActionInput'; +import ERROR_MESSAGE from '@constants/errorMessage'; + const usePutAndDeleteBillAction = ( initialValue: InputPair, validateFunc: (inputPair: Bill) => ValidateResult, @@ -66,7 +68,7 @@ const usePutAndDeleteBillAction = ( // blur시 값이 비었을 때 error state 반영 if (inputPair.price.length === 0 || inputPair.title.length === 0) { - setErrorMessage('값은 비어있을 수 없어요'); + setErrorMessage(ERROR_MESSAGE.preventEmpty); setErrorInfo({title: inputPair.title.length === 0, price: inputPair.price.length === 0}); setCanSubmit(false); return;