콘텐츠 댓글 수정 오류

- 댓글 수정 모드 상태에서 다른 댓글 쓰기 혹은 삭제 등의 액션을 해서 댓글 수의 변화가 있을 때 내 글이 아닌 다른 사람의 글이 수정 모드로 보이는 버그 수정
This commit is contained in:
Yu Sung
2025-03-18 22:52:39 +09:00
parent d5e1acb1c3
commit dfe17c7797
5 changed files with 45 additions and 34 deletions

View File

@@ -14,6 +14,7 @@ class AudioContentCommentListViewModel: ObservableObject {
private let repository = ContentRepository()
private var subscription = Set<AnyCancellable>()
@Published var isRegisterComment = false
@Published var isLoading = false
@Published var errorMessage = ""
@Published var isShowPopup = false
@@ -85,6 +86,7 @@ class AudioContentCommentListViewModel: ObservableObject {
}
isLoading = true
isRegisterComment = true
repository.registerComment(audioContentId: audioContentId, comment: comment, isSecret: isSecret)
.sink { result in
@@ -96,6 +98,7 @@ class AudioContentCommentListViewModel: ObservableObject {
}
} receiveValue: { [unowned self] response in
self.isLoading = false
self.isRegisterComment = false
let responseData = response.data
do {
@@ -103,6 +106,7 @@ class AudioContentCommentListViewModel: ObservableObject {
let decoded = try jsonDecoder.decode(ApiResponseWithoutData.self, from: responseData)
if decoded.success {
self.commentList.removeAll()
self.comment = ""
self.page = 1
self.isLast = false