diff --git a/src/components/user/RegisterForm.vue b/src/components/user/RegisterForm.vue index 726df69..3a6b41d 100644 --- a/src/components/user/RegisterForm.vue +++ b/src/components/user/RegisterForm.vue @@ -252,8 +252,15 @@ profile.value = file; }; - // 아이디 중복체크 + // 아이디 체크 const checkIdDuplicate = async () => { + // 길이 검증 먼저 수행 + if (id.value.length < 4) { + idError.value = '아이디는 4자리 이상이어야 합니다.'; + idErrorAlert.value = true; + return; + } + const response = await $api.get(`/user/checkId?memberIds=${id.value}`); if (!response.data.data) { idErrorAlert.value = true; @@ -331,6 +338,16 @@ } }; + watch(id, (newValue) => { + if (newValue && newValue.length >= 4) { + idError.value = ''; + idErrorAlert.value = false; + } else if (newValue && newValue.length < 4) { + idError.value = '아이디는 4자리 이상이어야 합니다.'; + idErrorAlert.value = true; + } + }); + watch(password, (newValue) => { if (newValue && newValue.length >= 4) { passwordErrorAlert.value = false; @@ -355,7 +372,13 @@ addressAlert.value = address.value.trim() === ''; phoneAlert.value = phone.value.trim() === ''; - // 비밀번호 길이 체크 로직 수정 + // 아이디 길이 체크 + if (id.value && id.value.length < 4) { + idErrorAlert.value = true; + idError.value = '아이디는 4자리 이상이어야 합니다.'; + } + + // 비밀번호 길이 체크 if (password.value && password.value.length < 4) { passwordErrorAlert.value = true; passwordError.value = '비밀번호는 4자리 이상이어야 합니다.'; @@ -383,7 +406,7 @@ idAlert.value || idErrorAlert.value || passwordAlert.value || - passwordcErrorAlert.value || + passwordErrorAlert.value || passwordcheckAlert.value || passwordcheckErrorAlert.value || pwhintResAlert.value ||