From 5136eef4bc7c11e2af5ff218f2d9a8b3d6adb52a Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Tue, 28 Jun 2022 09:55:39 +0200 Subject: [PATCH] :sparkles: Update auth urls navigation --- frontend/src/app/main/ui/routes.cljs | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/frontend/src/app/main/ui/routes.cljs b/frontend/src/app/main/ui/routes.cljs index a456f7bd4..3a2f87b3f 100644 --- a/frontend/src/app/main/ui/routes.cljs +++ b/frontend/src/app/main/ui/routes.cljs @@ -92,17 +92,23 @@ (defn on-navigate [router path] - (let [match (match-path router path) - profile (:profile @storage) - nopath? (or (= path "") (= path "/")) - authed? (and (not (nil? profile)) - (not= (:id profile) uuid/zero))] + (let [match (match-path router path) + profile (:profile @storage) + nopath? (or (= path "") (= path "/")) + path-name (-> match :data :name) + authpath? (some #(= path-name %) '(:auth-login + :auth-register + :auth-register-validate + :auth-register-success + :auth-recovery-request + :auth-recovery)) + authed? (and (not (nil? profile)) + (not= (:id profile) uuid/zero))] (cond - (and nopath? authed? (nil? match)) - (if (not= uuid/zero profile) - (st/emit! (rt/nav :dashboard-projects {:team-id (du/get-current-team-id profile)})) - (st/emit! (rt/nav :auth-login))) + (or (and nopath? authed? (nil? match)) + (and authpath? authed?)) + (st/emit! (rt/nav :dashboard-projects {:team-id (du/get-current-team-id profile)})) (and (not authed?) (nil? match)) (st/emit! (rt/nav :auth-login))