크리에이터 커뮤니티 댓글이 써지지 않던 버그 수정
This commit is contained in:
parent
d53392ddcd
commit
623640d410
|
@ -119,49 +119,47 @@ class CreatorCommunityAllViewModel: ObservableObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
func createCommunityPostComment(comment: String, postId: Int, parentId: Int? = nil) {
|
func createCommunityPostComment(comment: String, postId: Int, parentId: Int? = nil) {
|
||||||
if !isLoading && !isLast {
|
isLoading = true
|
||||||
isLoading = true
|
|
||||||
|
repository.createCommunityPostComment(comment: comment, postId: postId, parentId: parentId)
|
||||||
repository.createCommunityPostComment(comment: comment, postId: postId, parentId: parentId)
|
.sink { result in
|
||||||
.sink { result in
|
switch result {
|
||||||
switch result {
|
case .finished:
|
||||||
case .finished:
|
DEBUG_LOG("finish")
|
||||||
DEBUG_LOG("finish")
|
case .failure(let error):
|
||||||
case .failure(let error):
|
ERROR_LOG(error.localizedDescription)
|
||||||
ERROR_LOG(error.localizedDescription)
|
}
|
||||||
}
|
} receiveValue: { [unowned self] response in
|
||||||
} receiveValue: { [unowned self] response in
|
let responseData = response.data
|
||||||
let responseData = response.data
|
|
||||||
|
do {
|
||||||
|
let jsonDecoder = JSONDecoder()
|
||||||
|
let decoded = try jsonDecoder.decode(ApiResponseWithoutData.self, from: responseData)
|
||||||
|
|
||||||
do {
|
if decoded.success {
|
||||||
let jsonDecoder = JSONDecoder()
|
DispatchQueue.main.async {
|
||||||
let decoded = try jsonDecoder.decode(ApiResponseWithoutData.self, from: responseData)
|
self.pageSize *= self.page
|
||||||
|
self.page = 1
|
||||||
if decoded.success {
|
self.isLast = false
|
||||||
DispatchQueue.main.async {
|
self.getCommunityPostList()
|
||||||
self.pageSize *= self.page
|
|
||||||
self.page = 1
|
|
||||||
self.isLast = false
|
|
||||||
self.getCommunityPostList()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if let message = decoded.message {
|
|
||||||
self.errorMessage = message
|
|
||||||
} else {
|
|
||||||
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
|
|
||||||
}
|
|
||||||
|
|
||||||
self.isShowPopup = true
|
|
||||||
}
|
}
|
||||||
} catch {
|
} else {
|
||||||
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
|
if let message = decoded.message {
|
||||||
|
self.errorMessage = message
|
||||||
|
} else {
|
||||||
|
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
|
||||||
|
}
|
||||||
|
|
||||||
self.isShowPopup = true
|
self.isShowPopup = true
|
||||||
}
|
}
|
||||||
|
} catch {
|
||||||
self.isLoading = false
|
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
|
||||||
|
self.isShowPopup = true
|
||||||
}
|
}
|
||||||
.store(in: &subscription)
|
|
||||||
}
|
self.isLoading = false
|
||||||
|
}
|
||||||
|
.store(in: &subscription)
|
||||||
}
|
}
|
||||||
|
|
||||||
func report(reason: String) {
|
func report(reason: String) {
|
||||||
|
|
Loading…
Reference in New Issue