feat(auth): 手机号验证码登录(会话模型 + 登录页 + 导航接入)
This commit is contained in:
@@ -55,6 +55,7 @@ const val PROFILE_ROUTE = "profile"
|
||||
|
||||
@Composable
|
||||
fun ProfileScreen(
|
||||
onNavigateToAuth: () -> Unit,
|
||||
onLoggedOut: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
viewModel: ProfileViewModel = hiltViewModel(),
|
||||
@@ -68,7 +69,7 @@ fun ProfileScreen(
|
||||
|
||||
when (val state = uiState) {
|
||||
is ProfileUiState.Loading -> ProfileSkeleton(modifier)
|
||||
is ProfileUiState.LoggedOut -> LoggedOutState(onLogin = viewModel::login, modifier = modifier)
|
||||
is ProfileUiState.LoggedOut -> LoggedOutState(onLogin = onNavigateToAuth, modifier = modifier)
|
||||
is ProfileUiState.Error -> ErrorState(
|
||||
message = state.message,
|
||||
onRetry = {},
|
||||
|
||||
@@ -52,12 +52,6 @@ class ProfileViewModel @Inject constructor(
|
||||
private val _logoutEvents = MutableSharedFlow<Unit>()
|
||||
val logoutEvents: SharedFlow<Unit> = _logoutEvents
|
||||
|
||||
fun login() {
|
||||
viewModelScope.launch {
|
||||
sessionRepository.login()
|
||||
}
|
||||
}
|
||||
|
||||
fun logout() {
|
||||
viewModelScope.launch {
|
||||
sessionRepository.logout()
|
||||
|
||||
Reference in New Issue
Block a user