Skip to content

Instantly share code, notes, and snippets.

@hieuwu
Created August 1, 2023 14:35
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
@HiltViewModel
class SignUpViewModel @Inject constructor(
private val authenticationRepository: AuthenticationRepository
) : ViewModel() {
private val _email = MutableStateFlow("")
val email: Flow<String> = _email
private val _password = MutableStateFlow("")
val password = _password
fun onEmailChange(email: String) {
_email.value = email
}
fun onPasswordChange(password: String) {
_password.value = password
}
fun onSignUp() {
viewModelScope.launch {
authenticationRepository.signUp(
email = _email.value,
password = _password.value
)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment