Skip to content

Commit

Permalink
fix:#2448 Handle network error in HomeViewModel to emit error
Browse files Browse the repository at this point in the history
  • Loading branch information
SaiThanushreddy committed Jan 1, 2024
1 parent ecbf4b6 commit 64f9369
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,18 @@ class HomeViewModel @Inject constructor(private val homeRepositoryImp: HomeRepos
viewModelScope.launch {
_homeUiState.value = HomeUiState.Loading
homeRepositoryImp.clientAccounts().catch {
_homeUiState.value = HomeUiState.Error(R.string.error_fetching_accounts)
_homeUiState.value = HomeUiState.Error(R.string.no_internet_connection)
}.collect { clientAccounts ->
_homeUiState.value = HomeUiState.ClientAccountDetails(
getLoanAccountDetails(clientAccounts.loanAccounts),
getSavingAccountDetails(clientAccounts.savingsAccounts)
)

}
}
}


val userDetails: Unit
get() {
viewModelScope.launch {
Expand Down

0 comments on commit 64f9369

Please sign in to comment.