viewmodel fix

This commit is contained in:
solovushka56
2025-12-12 10:42:32 +03:00
parent 011e169f96
commit fa68925205
2 changed files with 3 additions and 5 deletions

View File

@@ -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 -> {

View File

@@ -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 ?: "Ошибка загрузки данных"
)
}