mirror of
https://github.com/penpot/penpot.git
synced 2025-02-18 21:06:11 -05:00
🐛 Fix initial page loading.
This commit is contained in:
parent
140135317c
commit
4e382d456f
2 changed files with 10 additions and 6 deletions
|
@ -43,9 +43,13 @@
|
||||||
[router path]
|
[router path]
|
||||||
(let [match (rt/match router path)]
|
(let [match (rt/match router path)]
|
||||||
(prn "main$on-navigate" path)
|
(prn "main$on-navigate" path)
|
||||||
|
|
||||||
(cond
|
(cond
|
||||||
#_(and (= path "") (nil? match))
|
(and (= path "") (:auth storage))
|
||||||
#_(html-history/set-path! "/dashboard/projects")
|
(st/emit! (rt/nav :dashboard/projects))
|
||||||
|
|
||||||
|
(and (= path "") (not (:auth storage)))
|
||||||
|
(st/emit! (rt/nav :auth/login))
|
||||||
|
|
||||||
(nil? match)
|
(nil? match)
|
||||||
(prn "TODO 404 main")
|
(prn "TODO 404 main")
|
||||||
|
|
|
@ -14,10 +14,6 @@
|
||||||
(defonce locale (atom (get storage ::locale cfg/default-language)))
|
(defonce locale (atom (get storage ::locale cfg/default-language)))
|
||||||
(defonce state (atom {}))
|
(defonce state (atom {}))
|
||||||
|
|
||||||
(defn set-default-locale!
|
|
||||||
[]
|
|
||||||
(set-current-locale! cfg/default-language))
|
|
||||||
|
|
||||||
(defn update-locales!
|
(defn update-locales!
|
||||||
[callback]
|
[callback]
|
||||||
(swap! state callback))
|
(swap! state callback))
|
||||||
|
@ -27,6 +23,10 @@
|
||||||
(swap! storage assoc ::locale v)
|
(swap! storage assoc ::locale v)
|
||||||
(reset! locale v))
|
(reset! locale v))
|
||||||
|
|
||||||
|
(defn set-default-locale!
|
||||||
|
[]
|
||||||
|
(set-current-locale! cfg/default-language))
|
||||||
|
|
||||||
(defn on-locale-change!
|
(defn on-locale-change!
|
||||||
[callback]
|
[callback]
|
||||||
(add-watch locale ::main (fn [_ _ old-locale new-locale]
|
(add-watch locale ::main (fn [_ _ old-locale new-locale]
|
||||||
|
|
Loading…
Add table
Reference in a new issue