Skip to content

Commit

Permalink
feat: 첫번째 요청 결과 last 인데 현재 진행, 예정만 있다면 과거 요청을 한번 더 보낸다
Browse files Browse the repository at this point in the history
  • Loading branch information
SeongHoonC committed May 19, 2024
1 parent 80804ba commit 935428a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,13 @@ class ArtistDetailViewModel @Inject constructor(
onBookmarkClick = ::toggleArtistBookmark,
)

if (festivalPage.festivals.isEmpty()) {
if(!festivalPage.isLastPage) {
return@launch
}
val lastFestival = festivalPage.festivals.lastOrNull()
if (lastFestival == null || lastFestival.endDate >= LocalDate.now()) {
loadMoreArtistFestivals(id)
return@launch
}
}.onFailure {
handleFailure(key = KEY_LOAD_ARTIST_DETAIL, throwable = it)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,13 @@ class SchoolDetailViewModel @Inject constructor(
isLast = festivalPage.isLastPage,
onBookmarkClick = { schoolId -> toggleSchoolBookmark(schoolId) },
)
if (festivalPage.festivals.isEmpty()) {
if (!festivalPage.isLastPage) {
return@launch
}
val lastFestival = festivalPage.festivals.lastOrNull()
if (lastFestival == null || lastFestival.endDate >= LocalDate.now()) {
loadMoreSchoolFestivals(schoolId)
return@launch
}
}.onFailure {
handleFailure(key = KEY_LOAD_SCHOOL_DETAIL, throwable = it)
Expand Down

0 comments on commit 935428a

Please sign in to comment.