feat(home): 홈 탭 당겨서 새로고침을 추가한다
This commit is contained in:
@@ -21,16 +21,14 @@ final class MainHomeRecommendationViewModel: ObservableObject {
|
||||
|
||||
repository.getRecommendations()
|
||||
.sink { [weak self] result in
|
||||
guard let self else { return }
|
||||
|
||||
switch result {
|
||||
case .finished:
|
||||
DEBUG_LOG("finish")
|
||||
case .failure(let error):
|
||||
ERROR_LOG(error.localizedDescription)
|
||||
self.errorMessage = I18n.Common.commonError
|
||||
self.isShowPopup = true
|
||||
self.isLoading = false
|
||||
self?.errorMessage = I18n.Common.commonError
|
||||
self?.isShowPopup = true
|
||||
self?.isLoading = false
|
||||
}
|
||||
} receiveValue: { [weak self] response in
|
||||
guard let self else { return }
|
||||
@@ -58,6 +56,16 @@ final class MainHomeRecommendationViewModel: ObservableObject {
|
||||
.store(in: &subscription)
|
||||
}
|
||||
|
||||
func refresh() async {
|
||||
if !isLoading {
|
||||
fetchRecommendations()
|
||||
}
|
||||
|
||||
for await isLoading in $isLoading.values {
|
||||
if !isLoading { return }
|
||||
}
|
||||
}
|
||||
|
||||
func followAll(creatorIds: [Int], completionKey: String) {
|
||||
guard !creatorIds.isEmpty, !completionKey.isEmpty else { return }
|
||||
guard !completedFollowKeys.contains(completionKey), !followingKeys.contains(completionKey) else { return }
|
||||
|
||||
Reference in New Issue
Block a user