Авторизация, нерабочий чат

This commit is contained in:
Халимов Рустам
2026-04-14 01:41:51 +03:00
parent 1fb1be47dd
commit dc051fa9ae
22 changed files with 160 additions and 49 deletions

View File

@@ -22,9 +22,13 @@ class AuthViewModel @Inject constructor(
private val repository: AuthRepository
) : ViewModel() {
private val _state = MutableStateFlow(AuthState())
private val _state = MutableStateFlow(AuthState(isAuthenticated = repository.isAuthenticated()))
val state: StateFlow<AuthState> = _state.asStateFlow()
fun checkAuth() {
_state.update { it.copy(isAuthenticated = repository.isAuthenticated()) }
}
fun login(userName: String, password: String) {
viewModelScope.launch {
_state.update { it.copy(isLoading = true, error = null) }