🐛 Fix unexpected exception after logout.

This commit is contained in:
Andrey Antukh 2020-02-20 09:41:30 +01:00
parent 5d1b358179
commit 35e50dc47c
3 changed files with 6 additions and 21 deletions

View file

@ -64,7 +64,7 @@
(ptk/reify ::clear-user-data (ptk/reify ::clear-user-data
ptk/UpdateEvent ptk/UpdateEvent
(update [_ state] (update [_ state]
(merge state (dissoc initial-state :route :router))) (select-keys state [:route :router :session-id]))
ptk/WatchEvent ptk/WatchEvent
(watch [_ state s] (watch [_ state s]
@ -79,7 +79,7 @@
(def logout (def logout
(ptk/reify ::logout (ptk/reify ::logout
ptk/WatchEvent ptk/WatchEvent
(watch [_ state s] (watch [_ state stream]
(rx/of (rt/nav :login) (rx/of (rt/nav :login)
clear-user-data)))) clear-user-data))))

View file

@ -54,24 +54,9 @@
nil)) nil))
(def initial-state (def initial-state
{:route nil {:session-id (uuid/next)
:router nil :profile (:profile storage)})
:session-id (uuid/next) ;; :colors-collections colors/collections})
:auth (:auth storage)
:profile (:profile storage)
:clipboard #queue []
:undo {}
:workspace-layout nil
:workspace-local nil
:workspace-pdata nil
:images-collections nil
:images nil
:icons-collections nil
:icons nil
:colors-collections colors/collections
:projects nil
:pages nil
:pages-data nil})
(defn init (defn init
"Initialize the state materialization." "Initialize the state materialization."

View file

@ -109,7 +109,7 @@
(and (map? error) (and (map? error)
(= :authentication type) (= :authentication type)
(= :unauthorized code)) (= :unauthorized code))
(ts/schedule 0 #(st/emit! (rt/nav :login))) (ts/schedule 0 #(st/emit! logout))
;; Network error ;; Network error
(and (map? error) (and (map? error)