fixed login loop.
This commit is contained in:
@@ -142,12 +142,17 @@
|
|||||||
(re-frame/reg-event-fx
|
(re-frame/reg-event-fx
|
||||||
::set-active-route
|
::set-active-route
|
||||||
(fn [{:keys [db]} [_ handler params route-params]]
|
(fn [{:keys [db]} [_ handler params route-params]]
|
||||||
|
(println "HANDELR IS" handler (:user db))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(if (and (not= :login handler) (not (:user db)))
|
(cond
|
||||||
{:redirect "/login"
|
(and (not= :login handler) (not (:user db)))
|
||||||
:db (assoc db :active-route :login
|
{:redirect (bidi/path-for routes/routes :login)
|
||||||
:page-failure nil)}
|
:db (assoc db :active-route :login
|
||||||
|
:active-page :login
|
||||||
|
:page-failure nil)}
|
||||||
|
:else
|
||||||
{:db (-> db
|
{:db (-> db
|
||||||
(assoc :active-route handler
|
(assoc :active-route handler
|
||||||
:page-failure nil
|
:page-failure nil
|
||||||
|
|||||||
@@ -144,8 +144,9 @@
|
|||||||
(let [ap (re-frame/subscribe [::subs/active-page])
|
(let [ap (re-frame/subscribe [::subs/active-page])
|
||||||
current-client @(re-frame/subscribe [::subs/client])
|
current-client @(re-frame/subscribe [::subs/client])
|
||||||
is-loading? @(re-frame/subscribe [::subs/is-initial-loading?])]
|
is-loading? @(re-frame/subscribe [::subs/is-initial-loading?])]
|
||||||
(if is-loading?
|
(when @ap
|
||||||
[loading-layout]
|
(if is-loading?
|
||||||
|
[loading-layout]
|
||||||
[:div
|
|
||||||
^{:key (str @ap "-" current-client)} [page @ap]])))
|
[:div
|
||||||
|
^{:key (str @ap "-" current-client)} [page @ap]]))))
|
||||||
|
|||||||
Reference in New Issue
Block a user