I have encoded an object via bs-json and want to send it as a data via post using bs-axios.
33 │ let createTest = (p: Data.toBuyListItem) => inst->Instance.postData("/
test", p |> Data.encodeToBuyListItem);
...
This has type:
Js.Json.t (defined as Js.Json.t)
But somewhere wanted:
Js.t('a)
p |> Data.encodeToBuyListItem
is red. How to use the Js.Json.t
value as data for a post request?
Edit:
Well, this works:
let createTest = (p: Data.toBuyListItem) => inst->Instance.postData("/test", [%raw "p"]);
but I would prefer a non-hacky solution (preferably using bs-json, since I am using that for decoding JSON)...