Description
I am trying to figure out how to use JSObject.global.fetch.function!
along with JSPromise
to assemble a PUT request with a body and headers. I keep falling flat on my face 😣 I am able to use fetch
and preform GET requests, parse the JSON, and the whole-nine-yards, but I don't understand where to go for sending data.
I have tried assembling a params object using something like this JSObject.construct(from: ["method": "PUT", "body": json.jsString].jsValue)
and passing it as a second parameter to fetch
. Doing this though, when handling the .then
statement I receive an error of:
/Users/lorenalexm/Projects/SwiftScheduleCheck/Sources/SwiftScheduleCheck/Views/ContentView.swift:118:16: Cannot convert value of type '()' to closure result type 'ConvertibleToJSValue'
Might anyone help provide a bit of guidance on how to proceed from here? Thank you!