reflex-gadt-api-0.2.2.1: Interact with a GADT API in your reflex-dom application.
Safe HaskellNone
LanguageHaskell2010

Reflex.Dom.GadtApi.XHR

Synopsis

Documentation

performXhrRequests :: forall t m api. (Has FromJSON api, forall a. ToJSON (api a), Prerender t m, Applicative m) => ApiEndpoint -> Event t (RequesterData api) -> m (Event t (RequesterData (Either Text))) Source #

Takes the output of a RequesterT widget and issues that output as API requests. The result of this function can be fed back into the requester as responses. For example:

rec (appResult, requests) <- runRequesterT myApplication responses
    responses <- performXhrRequests myApiEndpoint requests

apiRequestXhr :: forall api m. (MonadIO m, MonadJSM m, Has FromJSON api, forall a. ToJSON (api a)) => ApiEndpoint -> RequesterData api -> m (RequesterData (Either Text)) Source #

Encodes an API request as JSON and issues an XhrRequest, and attempts to decode the response.