Fork me on GitHub
#re-frame
<
2022-12-11
>
fabrao18:12:25

Hello all, I'm having problems with CORS Policy using :http-xhrio and I know that using :with-credentials false works. How can I pass this configuration to the request? I tried using this:

{:http-xhrio {:with-credentials false ...}}
but it didn't work.

p-himik19:12:00

:with-credentials will only work when the server is explicitly set up to accept cross-origin requests. Also, I'm pretty sure that in order to enable this behavior on the client side, that attribute must be true, not false.

floscr19:12:08

Is it valid to write a promise chain like this with dispatches inbetween?

(defn load-fn []
  (->> (fn-that-creates-promise+)
       (.then (fn [data]
                ;; Show a loading screen to the user
                (dispatch [:start-loading])
                ;; Start processing side-effect
                (start-long-process+ data+)))
       ;; data processing finished save result to db
       (.then (fn [data]
                (dispatch [:save-result data])))))

p-himik19:12:56

If it's in some effect - sure, seems reasonable.

👍 1