Skip to content

Commit

Permalink
로그인 페이지에서 검증 지연 문제 해결 (#613)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddarkr authored Feb 18, 2024
1 parent 5851307 commit 6d0e7f2
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/fsevents-patch-6b67494872-10.zip
Binary file not shown.
12 changes: 6 additions & 6 deletions src/pages/login/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import { validator } from '~/utils/validator';

export default function Login() {
const { fireToast } = useToast();
const email = useInput({ useDebounce: true });
const password = useInput({ useDebounce: true });
const email = useInput({});
const password = useInput({});
const [isPending, setIsPending] = useState(false);
const [emailError, setEmailError] = useState('');
const [passwordError, setPasswordError] = useState('');
Expand Down Expand Up @@ -47,20 +47,20 @@ export default function Login() {
};

useDidUpdate(() => {
if (!validator({ type: 'email', value: email.debouncedValue })) {
if (!validator({ type: 'email', value: email.value })) {
setEmailError('올바른 이메일을 입력해주세요.');
} else {
setEmailError('');
}
}, [email.debouncedValue]);
}, [email.value]);

useDidUpdate(() => {
if (password.debouncedValue.length >= 6) {
if (password.value.length >= 6) {
setPasswordError('');
} else {
setPasswordError('비밀번호는 6자리 이상이여야 합니다.');
}
}, [password.debouncedValue]);
}, [password.value]);

useDidUpdate(() => {
if (loginMutationData && loginMutationData.data) {
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4917,8 +4917,8 @@ __metadata:

"eslint-plugin-ygt-rules@file:./eslint::locator=ygtang-client%40workspace%3A.":
version: 1.0.0
resolution: "eslint-plugin-ygt-rules@file:./eslint#./eslint::hash=7d15ff&locator=ygtang-client%40workspace%3A."
checksum: 10/bb8c272f86c3d3aa348daa26540f329ffc51d7b5502788accefc36bd3b6e7b5887c8e9a61cace9643ebf65a1e6d82b6eb372804a01889ad7221c1f4f1249d0a2
resolution: "eslint-plugin-ygt-rules@file:./eslint#./eslint::hash=881f1a&locator=ygtang-client%40workspace%3A."
checksum: 10/017b5a4750bc8719d5499096fcac41f37e5943b7bcf6bb6cdb7a404346f38b0303da88f75e63679d618d61bebb2879d9722d48b726271db9d79f1e30a272330e
languageName: node
linkType: hard

Expand Down

0 comments on commit 6d0e7f2

Please sign in to comment.