0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-10 08:50:57 -05:00

Merge pull request #2054 from penpot/superalex-update-auth-urls-navigation

 Update auth urls navigation
This commit is contained in:
Andrey Antukh 2022-06-29 08:35:41 +02:00 committed by GitHub
commit b68407a6c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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))