feat(creator): 커뮤니티 좋아요를 연결한다
This commit is contained in:
@@ -4,6 +4,7 @@ import Combine
|
||||
final class CreatorChannelViewModel: ObservableObject {
|
||||
private let repository = CreatorChannelHomeRepository()
|
||||
private let userRepository = UserRepository()
|
||||
private let communityRepository = CreatorCommunityRepository()
|
||||
private var subscription = Set<AnyCancellable>()
|
||||
|
||||
@Published var isLoading = false
|
||||
@@ -101,6 +102,25 @@ final class CreatorChannelViewModel: ObservableObject {
|
||||
.store(in: &subscription)
|
||||
}
|
||||
|
||||
func likeCommunityPost(postId: Int) {
|
||||
guard postId > 0 else { return }
|
||||
|
||||
communityRepository.communityPostLike(postId: postId)
|
||||
.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
|
||||
}
|
||||
} receiveValue: { _ in }
|
||||
.store(in: &subscription)
|
||||
}
|
||||
|
||||
private func applyApiFailedPlaceholderState() {
|
||||
response = nil
|
||||
isApiFailedPlaceholderVisible = true
|
||||
|
||||
Reference in New Issue
Block a user