viewmodel fix
This commit is contained in:
1 parent
011e169f96
commit
fa68925205
2 files changed
+3
-5
No files matched your search
@@ -141,15 +141,12 @@ object NetworkDataSource {
|
||||
HttpStatusCode.OK -> {
|
||||
try {
|
||||
val body = response.body<Map<String, List<PlaceInfo>>>()
|
||||
println("Parsed response: $body")
|
||||
body
|
||||
} catch (e: Exception) {
|
||||
println("Parsing error: ${e.message}")
|
||||
emptyMap()
|
||||
}
|
||||
}
|
||||
HttpStatusCode.NoContent -> {
|
||||
println("No content received")
|
||||
emptyMap()
|
||||
}
|
||||
else -> {
|
||||
|
||||
@@ -83,8 +83,9 @@ class MainViewModel(
|
||||
onFailure = { error ->
|
||||
_uiState.update {
|
||||
MainState.Data(
|
||||
userName = authRepo.getUserInfo()?.name ?: "",
|
||||
userPhotoUrl = authRepo.getUserInfo()?.photo,
|
||||
userName = "",
|
||||
userPhotoUrl = null,
|
||||
bookings = emptyList(),
|
||||
error = error.message ?: "Ошибка загрузки данных"
|
||||
)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user