Skip to content

Commit 9a0ca9e

Browse files
committed
[BOOK-161] feat: 첫 페이지에서 성공 시 footerState 초기화 및 retry 이벤트 처리 수정
1 parent 7f07cf6 commit 9a0ca9e

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

feature/library/src/main/kotlin/com/ninecraft/booket/feature/library/LibraryPresenter.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ class LibraryPresenter @AssistedInject constructor(
7979

8080
if (page == START_INDEX) {
8181
uiState = UiState.Success
82+
footerState = FooterState.Idle
8283
} else {
8384
footerState = if (isLastPage) FooterState.End else FooterState.Idle
8485
}
@@ -121,11 +122,7 @@ class LibraryPresenter @AssistedInject constructor(
121122
}
122123

123124
is LibraryUiEvent.OnRetryClick -> {
124-
if (currentPage == START_INDEX) {
125-
getLibraryBooks(status = currentFilter.getApiValue(), page = currentPage, size = PAGE_SIZE)
126-
} else {
127-
getLibraryBooks(status = currentFilter.getApiValue(), page = currentPage + 1, size = PAGE_SIZE)
128-
}
125+
getLibraryBooks(status = currentFilter.getApiValue(), page = currentPage, size = PAGE_SIZE)
129126
}
130127
}
131128
}

feature/library/src/main/kotlin/com/ninecraft/booket/feature/library/LibraryUi.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ internal fun LibraryContent(
128128
}
129129

130130
is UiState.Error -> {
131-
ErrorResult(state.uiState)
131+
ErrorResult(state = state, errorMessage = state.uiState.message)
132132
}
133133
}
134134
}
@@ -159,7 +159,7 @@ private fun EmptyResult() {
159159
}
160160

161161
@Composable
162-
private fun ErrorResult(uiState: UiState.Error) {
162+
private fun ErrorResult(state: LibraryUiState, errorMessage: String) {
163163
Box(
164164
modifier = Modifier.fillMaxSize(),
165165
contentAlignment = Alignment.Center,
@@ -174,14 +174,14 @@ private fun ErrorResult(uiState: UiState.Error) {
174174
)
175175
Spacer(modifier = Modifier.height(ReedTheme.spacing.spacing2))
176176
Text(
177-
text = uiState.message,
177+
text = errorMessage,
178178
color = ReedTheme.colors.contentSecondary,
179179
style = ReedTheme.typography.body1Medium,
180180
)
181181
Spacer(modifier = Modifier.height(ReedTheme.spacing.spacing2))
182182
ReedButton(
183183
onClick = {
184-
// TODO: 다시 시도
184+
state.eventSink(LibraryUiEvent.OnRetryClick)
185185
},
186186
sizeStyle = largeButtonStyle,
187187
colorStyle = ReedButtonColorStyle.PRIMARY,

0 commit comments

Comments
 (0)