Created
August 1, 2023 14:35
-
-
Save hieuwu/4a6498dede9b1074bbc383e6553dd05c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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