nice logout sitch.

This commit is contained in:
Bryce Covert
2017-12-19 15:08:30 -08:00
parent 5e842a697b
commit 043e558a51
3 changed files with 27 additions and 21 deletions

View File

@@ -12,15 +12,14 @@
:active-page (:handler (bidi/match-route routes/routes (.. js/window -location -pathname))))))
(re-frame/reg-event-db
::toggle-company-menu
(fn [db [_ active-page]]
(update-in db [:menu :active?] #(not %))))
::toggle-menu
(fn [db [_ which]]
(update-in db [:menu which :active?] #(not %))))
(re-frame/reg-event-db
::logged-in
(fn [db [_ token user]]
(doto (assoc db :user (assoc user :token token))
println)))
(assoc db :user (assoc user :token token))))
(re-frame/reg-event-db
::swap-company
@@ -85,10 +84,15 @@
(fn [db [_ invoice]]
(assoc db :new-invoice {})))
(re-frame/reg-event-db
::logout
(fn [db [_]]
(assoc db :user nil :menu {:company {:active? false}
:account {:active? false}})))
(re-frame/reg-event-fx
::submit-new-invoice
(fn [{:keys [db]} [_ invoice]]
{:http {:method :post
:token (-> db :user)
:uri "/api/invoices"