re-frame-http-fx
re-frame-http-fx copied to clipboard
A re-frame "effects handler" for performing Ajax tasks (via cljs-ajax)
It's often useful to have things like status codes, headers, e.t.c. even in successful responses, e.g. when getting a 201 with a `Location` header. Currently we only return the body...
As of re-frame 1.1.2 there is a new interceptor available `unwrap`, this is the result of day8/re-frame#644 which promotes 2-vector of [event-id payload-map] **Proposal** - For backward compatibility, introduce new...
It's common to want to abort an in-progress HTTP request, perhaps if a more recent request comes along (for example the case of multiple autocomplete requests), or if the user...
Currently, people need to provide a response format with every request, by requiring `ajax.core` and calling `(ajax/json-response-format {:keywords? true})` or similar. cljs-ajax doesn't allow using keywords in `ajax-call` to lookup...
Same as #4 except for `:format` instead of `:response-format`. If not provided when doing a POST (for example) get a 'unrecognized request format nil' exception.
I am using an example provided in README. (rf/reg-event-db :good-http-result (fn [db [_ result]] (println db) (assoc db :api-result result))) (rf/reg-event-db :bad-http-result (fn [db [_ result]] (assoc db :api-result result)))...
I guess it's not that hard to implement given that `request->xhrio-options` already creates `goog.net.XhrIo` that supports `setProgressEventsEnabled`.
I've been working out how to get incremental results, not sure if you want to support it as `cljs-http` might be moving from xhrio (#21). I've got an issue open...
For logging and other events, its good to track the to original caller of the http request. Since internally, on-* is re-dispacted the event name in the fx `[{:keys [db]}...
We can optionally pass in a vector of requests instead of just one. As far as I can tell they are are independently launched and the on success is fired...