mirror of
https://github.com/penpot/penpot.git
synced 2025-06-02 22:11:37 +02:00
🐛 Fix all the time redirect to login.
This commit is contained in:
parent
7f8f8ecd62
commit
5636881463
1 changed files with 15 additions and 3 deletions
|
@ -11,6 +11,7 @@
|
|||
(:require
|
||||
[app.common.uuid :as uuid]
|
||||
[app.common.spec :as us]
|
||||
[app.main.repo :as rp]
|
||||
[app.main.data.auth :refer [logout]]
|
||||
[app.main.data.users :as udu]
|
||||
[app.main.store :as st]
|
||||
|
@ -51,10 +52,21 @@
|
|||
|
||||
(defn on-navigate
|
||||
[router path]
|
||||
(let [match (match-path 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))]
|
||||
|
||||
(cond
|
||||
(or (= path "")
|
||||
(nil? match))
|
||||
(and nopath? authed? (nil? match))
|
||||
(->> (rp/query! :profile)
|
||||
(rx/subs (fn [profile]
|
||||
(if (not= uuid/zero profile)
|
||||
(st/emit! (rt/nav :dashboard-projects {:team-id (:default-team-id profile)}))
|
||||
(st/emit! (rt/nav :auth-login))))))
|
||||
|
||||
(and (not authed?) (nil? match))
|
||||
(st/emit! (rt/nav :auth-login))
|
||||
|
||||
(nil? match)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue