@highpoint/bs-js-fetch
v0.7.0
Published
BuckleScript bindings for HighPoint Fetch Library
Downloads
2
Readme
bs-js-fetch
BuckleScript bindings for HighPoint's js-fetch.
Pre-requisites
Installation
yarn add @highpoint/bs-js-fetch
In your bsconfig.json
, include "@highpoint/bs-js-fetch"
in the bs-dependencies
.
Usage
open Fetch;
json(~url="http://google.com", ())
|> Js.Promise.then_(result => /* do something with `result` */ );
let abortController = AbortController.make();
postForm(
~url="schedule-builder",
~options=Options.(make(~body=Body.make("key1=value1&key2=value2", ~signal=(abortController |> AbortController.signal), ()))),
()
)
|> Js.Promise.then_(result => /* do something with `result` */ )
postJSON(
~url="message-center",
~options=Options.(make(~body=Body.makeWithUrlSearchParams(urlSearchParams), ())),
()
)
|> Js.Promise.then_(result => /* do something with `result` */ )