minor refactoring.

This commit is contained in:
Bryce Covert
2017-12-09 13:58:20 -08:00
parent 749b7b9633
commit 02a1ad0d47
3 changed files with 11 additions and 19 deletions

View File

@@ -21,30 +21,27 @@
(fn [db [_ new-invoices]]
(assoc-in db [:invoices] new-invoices)))
(re-frame/reg-event-db
::invoices-approved
(fn [db [_ new-invoices]]
(assoc-in db [:invoices :pending] new-invoices)))
(re-frame/reg-event-db
::invoices-rejected
(fn [db [_ new-invoices]]
(assoc-in db [:invoices :pending] new-invoices)))
(re-frame/reg-event-fx
::approve-invoices
(fn [cofx [_]]
{:http {:method :post
:uri "/api/invoices/approve"
:on-success ::invoices-approved
:on-success [::received-invoices :pending]
}}))
(re-frame/reg-event-fx
::view-unpaid-invoices
(fn [cofx []]
{:http {:method :get
:uri "/api/invoices/unpaid"
:on-success [::received-invoices :unpaid]}}))
(re-frame/reg-event-fx
::reject-invoices
(fn [cofx [_]]
{:http {:method :post
:uri "/api/invoices/reject"
:on-success ::invoices-rejected
:on-success [::received-invoices :pending]
}}))
(re-frame/reg-event-db