From bfcc430349d4e5601f271d4f53c94e1bcbdfa97e Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Thu, 4 Jan 2024 16:16:04 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A7=80=EA=B8=88=20=EB=9D=BC=EC=9D=B4?= =?UTF-8?q?=EB=B8=8C=20=EC=A4=91=20=EC=A0=84=EC=B2=B4=EB=B3=B4=EA=B8=B0=20?= =?UTF-8?q?-=20=EB=8B=B9=EA=B2=A8=EC=84=9C=20=EC=83=88=EB=A1=9C=EA=B3=A0?= =?UTF-8?q?=EC=B9=A8=EC=9D=B4=20=EB=90=98=EC=A7=80=20=EC=95=8A=EB=8D=98=20?= =?UTF-8?q?=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SodaLive/Sources/Live/LiveViewModel.swift | 5 +++++ SodaLive/Sources/Live/Now/All/LiveNowAllView.swift | 2 ++ 2 files changed, 7 insertions(+) diff --git a/SodaLive/Sources/Live/LiveViewModel.swift b/SodaLive/Sources/Live/LiveViewModel.swift index 3688c31..6099767 100644 --- a/SodaLive/Sources/Live/LiveViewModel.swift +++ b/SodaLive/Sources/Live/LiveViewModel.swift @@ -294,6 +294,7 @@ final class LiveViewModel: ObservableObject { ERROR_LOG(error.localizedDescription) } } receiveValue: { [unowned self] response in + self.isRefresh = false self.isLoading = false let responseData = response.data @@ -302,6 +303,10 @@ final class LiveViewModel: ObservableObject { let decoded = try jsonDecoder.decode(ApiResponse<[GetRoomListResponse]>.self, from: responseData) if let data = decoded.data, decoded.success { + if page < 2 { + self.liveNowItems.removeAll() + } + if !data.isEmpty { page += 1 self.liveNowItems.append(contentsOf: data) diff --git a/SodaLive/Sources/Live/Now/All/LiveNowAllView.swift b/SodaLive/Sources/Live/Now/All/LiveNowAllView.swift index 6d8c9fc..37baba9 100644 --- a/SodaLive/Sources/Live/Now/All/LiveNowAllView.swift +++ b/SodaLive/Sources/Live/Now/All/LiveNowAllView.swift @@ -24,6 +24,8 @@ struct LiveNowAllView: View { RefreshableScrollView( refreshing: $viewModel.isRefresh, action: { + viewModel.page = 1 + viewModel.isLast = false viewModel.getLiveNowList() }, content: {