Skip to content

Commit

Permalink
[FEATURE] #141 : ValidateWapMemberCodeUseCase 성공 시 회원 정보를 post 하도록 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
tgyuuAn committed Feb 27, 2024
1 parent 671c1a0 commit 9e5a6fc
Showing 1 changed file with 22 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,26 +57,38 @@ class SignUpViewModel @Inject constructor(
return@launch
}

postUserProfileUseCase(
userName = _signUpName.value,
studentId = _signUpStudentId.value,
registeredAt = "${_signUpYear.value} ${_signUpSemester.value}",
).onSuccess {
_signUpEventFlow.emit(SignUpEvent.SignUpSuccess)
validateWapMemberCodeUseCase(_wapMemberCode.value).onSuccess {
postUserProfileUseCase(
userName = _signUpName.value,
studentId = _signUpStudentId.value,
registeredAt = "${_signUpYear.value} ${_signUpSemester.value}",
).onSuccess {
_signUpEventFlow.emit(SignUpEvent.SignUpSuccess)
}.onFailure { throwable ->
_signUpEventFlow.emit(SignUpEvent.Failure(throwable))
}
}.onFailure { throwable ->
_signUpEventFlow.emit(SignUpEvent.Failure(throwable))
}
}

fun isValidStudentId(): Boolean = (_signUpStudentId.value.length == STUDENT_ID_LENGTH)

fun setName(name: String) { _signUpName.value = name }
fun setName(name: String) {
_signUpName.value = name
}

fun setStudentId(studentId: String) { _signUpStudentId.value = studentId }
fun setStudentId(studentId: String) {
_signUpStudentId.value = studentId
}

fun setYear(year: String) { _signUpYear.value = year }
fun setYear(year: String) {
_signUpYear.value = year
}

fun setSemester(semester: String) { _signUpSemester.value = semester }
fun setSemester(semester: String) {
_signUpSemester.value = semester
}

sealed class SignUpEvent {
data object ValidationSuccess : SignUpEvent()
Expand Down

0 comments on commit 9e5a6fc

Please sign in to comment.