feat(content): 콘텐츠 탭 당겨서 새로고침을 추가한다
This commit is contained in:
@@ -30,17 +30,15 @@ final class MainContentRecommendationViewModel: ObservableObject {
|
||||
|
||||
repository.getAudioRecommendations()
|
||||
.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.MainContentRecommendation.loadFailedMessage
|
||||
self.isShowPopup = true
|
||||
self.isLoading = false
|
||||
self.hasLoaded = true
|
||||
self?.errorMessage = I18n.MainContentRecommendation.loadFailedMessage
|
||||
self?.isShowPopup = true
|
||||
self?.isLoading = false
|
||||
self?.hasLoaded = true
|
||||
}
|
||||
} receiveValue: { [weak self] response in
|
||||
guard let self else { return }
|
||||
@@ -69,4 +67,14 @@ final class MainContentRecommendationViewModel: ObservableObject {
|
||||
}
|
||||
.store(in: &subscription)
|
||||
}
|
||||
|
||||
func refresh() async {
|
||||
if !isLoading {
|
||||
fetchRecommendations()
|
||||
}
|
||||
|
||||
for await isLoading in $isLoading.values {
|
||||
if !isLoading { return }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user