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 -> { HttpStatusCode.OK -> {
try { try {
val body = response.body<Map<String, List<PlaceInfo>>>() val body = response.body<Map<String, List<PlaceInfo>>>()
println("Parsed response: $body")
body body
} catch (e: Exception) { } catch (e: Exception) {
println("Parsing error: ${e.message}")
emptyMap() emptyMap()
} }
} }
HttpStatusCode.NoContent -> { HttpStatusCode.NoContent -> {
println("No content received")
emptyMap() emptyMap()
} }
else -> { else -> {

View File

@@ -83,8 +83,9 @@ class MainViewModel(
onFailure = { error -> onFailure = { error ->
_uiState.update { _uiState.update {
MainState.Data( MainState.Data(
userName = authRepo.getUserInfo()?.name ?: "", userName = "",
userPhotoUrl = authRepo.getUserInfo()?.photo, userPhotoUrl = null,
bookings = emptyList(),
error = error.message ?: "Ошибка загрузки данных" error = error.message ?: "Ошибка загрузки данных"
) )
} }