Skip to content

Commit 271ce42

Browse files
authored
Fix: post, patch race issue (#94)
* Fix: post, patch race issue * Feat:Add commentView isWaiting update * Feat: callAPIresponse in Task
1 parent d54ae33 commit 271ce42

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

Wastory/Wastory/ViewModel/ArticleViewModel/ArticleSettingViewModel.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,9 @@ import RichTextKit
179179
images: URLs,
180180
commentsEnabled: isCommentEnabled ? 1 : 0
181181
)
182-
isWaitingResponse = false
183182
}
184183
catch {
185184
print("Error: \(error.localizedDescription)")
186-
isWaitingResponse = false
187185
}
188186
}
189187
}
@@ -215,11 +213,9 @@ import RichTextKit
215213
images: URLs,
216214
commentsEnabled: isCommentEnabled ? 1 : 0
217215
)
218-
isWaitingResponse = false
219216
}
220217
catch {
221218
print("Error: \(error.localizedDescription)")
222-
isWaitingResponse = false
223219
}
224220
}
225221
}

Wastory/Wastory/ViewModel/ContentViewModel/CommentViewModel/CommentViewModel.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ import Observation
7272
page = 1
7373
isPageEnded = false
7474
comments = []
75+
isWaitingResponse = false
7576
}
7677

7778
//Network
@@ -171,10 +172,8 @@ import Observation
171172
print("patch comment")
172173
_ = try await NetworkRepository.shared.patchComment(
173174
commentID: editingComment?.id ?? 0, content: editingCommentText, isSecret: isEditingCommentSecret)
174-
isWaitingResponse = false
175175
} catch {
176176
print("Error: \(error.localizedDescription)")
177-
isWaitingResponse = false
178177
}
179178
}
180179
}
@@ -205,10 +204,8 @@ import Observation
205204
isSecret: self.isWritingCommentSecret
206205
)
207206
}
208-
isWaitingResponse = false
209207
} catch {
210208
print("Error: \(error.localizedDescription)")
211-
isWaitingResponse = false
212209
}
213210
}
214211
}

0 commit comments

Comments
 (0)