Skip to content

Commit cbf70d6

Browse files
committed
[MOD] #282 마라톤, 추천 코스에 대한 로딩 UiState 설정하기
1 parent 5d50bae commit cbf70d6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

app/src/main/java/com/runnect/runnect/presentation/discover/DiscoverViewModel.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ class DiscoverViewModel @Inject constructor(
9191

9292
private fun getMarathonCourse() {
9393
viewModelScope.launch {
94+
_marathonCourseState.value = UiStateV2.Loading
95+
9496
courseRepository.getMarathonCourse()
9597
.onSuccess { courses ->
9698
if (courses == null) {
@@ -113,6 +115,8 @@ class DiscoverViewModel @Inject constructor(
113115

114116
fun getRecommendCourse(pageNo: Int, ordering: String) {
115117
viewModelScope.launch {
118+
_recommendCourseState.value = UiStateV2.Loading
119+
116120
courseRepository.getRecommendCourse(pageNo = pageNo.toString(), ordering = ordering)
117121
.onSuccess { courses ->
118122
if (courses == null) {
@@ -125,6 +129,7 @@ class DiscoverViewModel @Inject constructor(
125129
_multiViewItems.add(courses)
126130
_recommendCourseState.value = UiStateV2.Success(courses)
127131
Timber.e("RECOMMEND COURSE GET SUCCESS")
132+
Timber.e("ITEM SIZE: ${multiViewItems.size}")
128133
}.onFailure { exception ->
129134
_recommendCourseState.value = UiStateV2.Failure(exception.message.toString())
130135
Timber.e("RECOMMEND COURSE GET FAIL")

0 commit comments

Comments
 (0)