Skip to content

Commit

Permalink
[BUG] 공지사항 뷰 수정 및 공지사항 Empty시 Empty 데이터 임시 추가 (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
ILWAT committed Nov 5, 2024
1 parent 7f01fbd commit 8a6b61f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Projects/Feature/Scene/Setting/Notice/NoticeFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,24 @@ public struct NoticeFeature {
return .run { _ in await self.dismiss() }

case .fetchNotice:
guard state.nextPage > -1 else { return .none }

return .run { [page = state.nextPage, size = state.size] send in
let response = try await noticeClient.getNotice(page, size)
return await send(.setNoticeData(response))
}

case let .setNoticeData(noticeData):
state.noticeList.append(contentsOf: noticeData)
state.nextPage += 1
if noticeData.isEmpty {
if state.nextPage == 0 {
let emptyNotice = NoticeModel(date: "Blink", title: "공지사항이 없어요", content: "아직 공지사항이 없어요!")
state.noticeList.append(emptyNotice)
}
state.nextPage = -1
} else {
state.noticeList.append(contentsOf: noticeData)
state.nextPage += 1
}
return .none

case let .expanding(target):
Expand Down
1 change: 1 addition & 0 deletions Projects/Feature/Scene/Setting/Notice/NoticeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public struct NoticeView: View {
leadingType: .dismiss("공지사항", { store.send(.tappedNaviBackButton) }),
trailingType: .none
)
.padding(.leading, 16)

ScrollView(.vertical) {
LazyVStack {
Expand Down

0 comments on commit 8a6b61f

Please sign in to comment.