Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FE] 계좌번호 입력 확인 버튼 활성화가 되지 않는 버그, 빈 값일 때 새로운 값이 반영되지 않는 버그 #602

Merged
merged 2 commits into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions client/src/hooks/useAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ const useAccount = () => {
const getChangedField = () => {
const changedField: Partial<Event> = {};

if (bankName.trim() !== '' && bankName !== bankNameState) {
if (bankNameState.trim() !== '' && bankName !== bankNameState) {
changedField.bankName = bankNameState;
}

if (accountNumber.trim() !== '' && accountNumber !== accountNumberState) {
if (accountNumberState.trim() !== '' && accountNumber !== accountNumberState) {
changedField.accountNumber = accountNumberState;
}

Expand All @@ -46,11 +46,11 @@ const useAccount = () => {
};

useEffect(() => {
const existEmptyField = bankName.trim() === '' && accountNumber.trim() === '';
const existEmptyField = bankNameState.trim() === '' || accountNumberState.trim() === '';
const isChanged = bankName !== bankNameState || accountNumber !== accountNumberState;

setCanSubmit(!existEmptyField && isChanged);
}, [bankName, accountNumber, bankNameState, accountNumberState]);
}, [bankNameState, accountNumberState]);

return {
bankName: bankNameState,
Expand Down
Loading