What I want is to trigger an XHR.perform
onMouseClick, using CalmmJS and React - I'm trying the following code, unnecessary parts redacted:
const getResults = someArg => XHR.perform({
timeout: 60 * 1000,
responseType: 'json',
method: 'POST',
url: U.string`/api/${ facet }/end-point/`,
body: U.stringify( someArg )
});
...
<SomeElement
...
onMouseClick={ U.ifElse(
shouldMakeXHR, /* Atom that runs its own debounced XHR checks, then
runs it through an R.equals to see if the result
is acceptable - result is either true or false */
_ => getResults( someArg ),
R.identity //as no-op
) }
/>
Currently I'm just trying to trigger the network request, not do anything with the result. Instead the XHR.perform
just gets swallowed without a trace. What am I doing wrong?
PS: Please could someone tag my post with karet or karet.util, as I am unable to create tags. Thanks for any help!