fix client-side state handling on user logout

This commit is contained in:
Gered 2016-07-31 15:08:08 -04:00
parent 1b0075cae5
commit 10713fa58f
2 changed files with 7 additions and 6 deletions

View file

@ -36,6 +36,8 @@
(reset! show-login false))
(defn logout!
[]
[on-success]
(ajax/POST (->url "/logout")
:on-success (fn [_]
(reset! user-profile nil)
(ajax/POST (->url "/logout")))
(on-success))))

View file

@ -45,9 +45,8 @@
[bs/Nav {:pull-right true}
(if (auth/authenticated?)
[bs/NavDropdown {:title (:username @auth/user-profile)}
[bs/MenuItem {:on-click (fn [_]
(auth/logout!)
(views/reconnect!))} "Logout"]]
[bs/MenuItem {:on-click #(auth/logout!
(fn [] (views/reconnect!)))} "Logout"]]
[bs/NavItem {:on-click auth/show-login-form!} "Login"])])]]
[bs/Modal
{:show (boolean @error)