fix: FeedbackView rawPost API call signature
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -100,15 +100,15 @@ struct FeedbackSheet: View {
|
|||||||
do {
|
do {
|
||||||
let body: [String: String] = ["text": text.trimmingCharacters(in: .whitespaces), "source": "ios"]
|
let body: [String: String] = ["text": text.trimmingCharacters(in: .whitespaces), "source": "ios"]
|
||||||
let jsonData = try JSONSerialization.data(withJSONObject: body)
|
let jsonData = try JSONSerialization.data(withJSONObject: body)
|
||||||
let (data, response) = try await APIClient.shared.rawPost("/api/feedback", body: jsonData)
|
let data = try await APIClient.shared.rawPost(path: "/api/feedback", data: jsonData)
|
||||||
|
|
||||||
if let httpResp = response as? HTTPURLResponse, httpResp.statusCode < 300 {
|
let respBody = try? JSONSerialization.jsonObject(with: data) as? [String: Any]
|
||||||
|
if respBody?["ok"] as? Bool == true {
|
||||||
withAnimation { sent = true }
|
withAnimation { sent = true }
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) {
|
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) {
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let respBody = try? JSONSerialization.jsonObject(with: data) as? [String: Any]
|
|
||||||
error = (respBody?["error"] as? String) ?? "Failed to send"
|
error = (respBody?["error"] as? String) ?? "Failed to send"
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
Reference in New Issue
Block a user