Updates for users.
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
::initialize-db
|
||||
(fn [{:keys [db]} [_ token]]
|
||||
(let [handler (:handler (bidi/match-route routes/routes (.. js/window -location -pathname)))]
|
||||
(prn (and token (jwt->data token)))
|
||||
(prn (and token (get (jwt->data token) "user/role")))
|
||||
(cond
|
||||
(and (not= :login handler) (not token))
|
||||
{:redirect "/login"
|
||||
@@ -26,7 +26,7 @@
|
||||
:active-page :login
|
||||
:user token)}
|
||||
|
||||
(and token (= "none" (get (jwt->data token) "role") ))
|
||||
(and token (= "none" (or (get (jwt->data token) "role") (get (jwt->data token) "user/role")) ))
|
||||
{:redirect "/needs-activation"
|
||||
:db (assoc db/default-db
|
||||
:active-page :needs-activation
|
||||
@@ -77,7 +77,8 @@
|
||||
(fn [db [_ {clients :client vendors :vendor :as x}]]
|
||||
(-> db
|
||||
(assoc :clients (by :id clients) )
|
||||
(assoc :vendors (by :id vendors) ))))
|
||||
(assoc :vendors (by :id vendors) )
|
||||
(assoc :client (when (= 1 (count clients)) (->> clients first :id ))))))
|
||||
|
||||
(re-frame/reg-event-db
|
||||
::swap-client
|
||||
|
||||
Reference in New Issue
Block a user