Skip to content

Commit

Permalink
♻️ Enhance nickname validation in signupViewModel
Browse files Browse the repository at this point in the history
  • Loading branch information
yjeong-k committed Nov 10, 2023
1 parent 3a05634 commit 257a93d
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class SignupViewModel @Inject internal constructor(
}

fun signup(emailInput: String) {
if (nicknameInput.isBlank() || nicknameInput.length > Constants.MAXIMUM_NICKNAME_LENGTH) { // Check nickname
if (nicknameInput.isBlank()) { // Check nickname
_uiState.update { currentState ->
currentState.copy(
isValidNickname = false,
Expand All @@ -111,6 +111,16 @@ class SignupViewModel @Inject internal constructor(
)
)
}
} else if (nicknameInput.length > Constants.MAXIMUM_NICKNAME_LENGTH) {
_uiState.update { currentState ->
currentState.copy(
isValidNickname = false,
error = SignupError(
type = SignupErrorType.NICKNAME,
messageId = R.string.nickname_qualification
)
)
}
} else if (!isValidPassword(passwordInput)) { // Check password length
_uiState.update { currentState ->
currentState.copy(
Expand Down

0 comments on commit 257a93d

Please sign in to comment.