Skip to content

Commit

Permalink
refactor : updateSelectedDate 함수 복구
Browse files Browse the repository at this point in the history
  • Loading branch information
huiwoo-jo committed Feb 22, 2024
1 parent 995282b commit c0a8a2c
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ class CafeteriaViewModel(
is NetworkResult.Success -> {
val menuList = result.data
_cafeteriaList.value = menuList
_selectedDate.value = LocalDate.now()
updateMenuList(selectedDate.toString())
updateSelectedDate(LocalDate.now())
_isError.postValue(false)
_isLoading.postValue(false)
}
Expand All @@ -61,6 +60,11 @@ class CafeteriaViewModel(
}
}

fun updateSelectedDate(selectedDate: LocalDate) {
_selectedDate.value = selectedDate
updateMenuList(selectedDate.toString())
}

private fun updateMenuList(selectedDate: String) {
val cafeteriaList = _cafeteriaList.value ?: emptyList()

Expand Down

0 comments on commit c0a8a2c

Please sign in to comment.