Skip to content

Commit

Permalink
refactor: 에러메시지 상수화
Browse files Browse the repository at this point in the history
  • Loading branch information
jinhokim98 committed Aug 8, 2024
1 parent 5cca493 commit 4ba16fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions client/src/constants/errorMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const ERROR_MESSAGE = {
memberName: '참여자 이름은 8자 이하의 한글, 영어만 가능해요',
purchasePrice: '10,000,000원 이하의 숫자만 입력이 가능해요',
purchaseTitle: '지출 이름은 30자 이하의 한글, 영어, 숫자만 가능해요',
preventEmpty: '값은 비어있을 수 없어요',
};

export default ERROR_MESSAGE;
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 4ba16fc

Please sign in to comment.