routes are now secured.

This commit is contained in:
Bryce Covert
2017-12-19 09:13:45 -08:00
parent 36806c9cf6
commit 5e842a697b
5 changed files with 48 additions and 29 deletions

View File

@@ -14,13 +14,16 @@
(re-frame/reg-fx
:http
(fn [{:keys [method uri on-success body headers]}]
(fn [{:keys [method uri on-success body headers token]}]
(go
(->> (http/request {:method method
:body body
:headers headers
:url uri})
(<! )
:body
(conj on-success)
(re-frame/dispatch)))))
(let [headers (if token
(assoc headers "Authorization" (str "Token " token))
headers)]
(->> (http/request {:method method
:body body
:headers headers
:url uri})
(<! )
:body
(conj on-success)
(re-frame/dispatch))))))