forked from Olympic/NTO-2025-Android-TeamTask
viewmodel fix
This commit is contained in:
@@ -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 -> {
|
||||||
|
|||||||
@@ -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 ?: "Ошибка загрузки данных"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user