mirror of
https://github.com/penpot/penpot.git
synced 2025-08-01 22:48:43 +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
|
(:require
|
||||||
[app.common.uuid :as uuid]
|
[app.common.uuid :as uuid]
|
||||||
[app.common.spec :as us]
|
[app.common.spec :as us]
|
||||||
|
[app.main.repo :as rp]
|
||||||
[app.main.data.auth :refer [logout]]
|
[app.main.data.auth :refer [logout]]
|
||||||
[app.main.data.users :as udu]
|
[app.main.data.users :as udu]
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
|
@ -51,10 +52,21 @@
|
||||||
|
|
||||||
(defn on-navigate
|
(defn on-navigate
|
||||||
[router path]
|
[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
|
(cond
|
||||||
(or (= path "")
|
(and nopath? authed? (nil? match))
|
||||||
(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))
|
(st/emit! (rt/nav :auth-login))
|
||||||
|
|
||||||
(nil? match)
|
(nil? match)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue