feat(creator): 커뮤니티 좋아요를 연결한다

This commit is contained in:
Yu Sung
2026-07-03 16:10:10 +09:00
parent aa735b7053
commit 884952db5a
3 changed files with 28 additions and 3 deletions

View File

@@ -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