Fork me on GitHub
Frankline Apiyo14:04:25

I'm trying to make requests to a server as stated in the documentation (using a :htttp-xhrio effect).

Frankline Apiyo14:04:31

Something like this

(reg-event-fx                             ;; note the trailing -fx
  :handler-with-http                      ;; usage:  (dispatch [:handler-with-http])
  (fn [{:keys [db]} _]                    ;; the first param will be "world"
    {:db   (assoc db :show-twirly true)   ;; causes the twirly-waiting-dialog to show??
     :http-xhrio {:method          :get
                  :uri             ""
                  :timeout         8000                                           ;; optional see API docs
                  :response-format (ajax/json-response-format {:keywords? true})  ;; IMPORTANT!: You must provide this.
                  :on-success      [:good-http-result]
                  :on-failure      [:bad-http-result]}}))

Frankline Apiyo14:04:46

and I'm wondering how to pass in credentials to that request

Frankline Apiyo14:04:59

How can I pass in a password and username?

Frankline Apiyo14:04:38

Any help will be appreciated, if anything isn't clear, I can clarify

Frankline Apiyo14:04:07

I've tried to look for this information in the documentation for cljs-ajax as well as `re-frame-http-fx` and couldn't find it


What type of auth to you want to use?

Frankline Apiyo14:04:01

But I'd also like to know how other kinds of auth can be done...


Have you tried setting the :headers field?


> other kinds of auth If it's just a web app, I wouldn't try anything else but cookies with a session ID.

Frankline Apiyo14:04:38

how do I add a username and password to the headers?


It's literally in the first sentence on the Wiki page about HTTP Basic auth. :)

Frankline Apiyo15:04:32

Yeah it is the first sentense 😆


Hi! What's the canonical way of deriving data when one subscription is parametrised by the value of another subscription? Here's a contrived example:

 :<- [::value]
 (fn [value]
   {:foo @(rf/subscribe [::b-given-a value])}))
IIRC we can use reg-sub-raw to subscribe+`deref` at will, but I'm unsure if the above is also fine


How do I use reframe in the repl?


In my project it works, but in the connected shadow-cljs repl, the dispatches and the subscribes are returning nil