minor refactoring.
This commit is contained in:
@@ -20,5 +20,5 @@
|
|||||||
:url uri})
|
:url uri})
|
||||||
(<! )
|
(<! )
|
||||||
:body
|
:body
|
||||||
(conj [on-success])
|
(conj on-success)
|
||||||
(re-frame/dispatch)))))
|
(re-frame/dispatch)))))
|
||||||
|
|||||||
@@ -21,30 +21,27 @@
|
|||||||
(fn [db [_ new-invoices]]
|
(fn [db [_ new-invoices]]
|
||||||
(assoc-in db [:invoices] 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
|
(re-frame/reg-event-fx
|
||||||
::approve-invoices
|
::approve-invoices
|
||||||
(fn [cofx [_]]
|
(fn [cofx [_]]
|
||||||
{:http {:method :post
|
{:http {:method :post
|
||||||
:uri "/api/invoices/approve"
|
: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
|
(re-frame/reg-event-fx
|
||||||
::reject-invoices
|
::reject-invoices
|
||||||
(fn [cofx [_]]
|
(fn [cofx [_]]
|
||||||
{:http {:method :post
|
{:http {:method :post
|
||||||
:uri "/api/invoices/reject"
|
:uri "/api/invoices/reject"
|
||||||
:on-success ::invoices-rejected
|
:on-success [::received-invoices :pending]
|
||||||
}}))
|
}}))
|
||||||
|
|
||||||
(re-frame/reg-event-db
|
(re-frame/reg-event-db
|
||||||
|
|||||||
@@ -67,12 +67,7 @@
|
|||||||
[:td invoice-number]
|
[:td invoice-number]
|
||||||
[:td date]
|
[:td date]
|
||||||
[:td total]])]]]))
|
[:td total]])]]]))
|
||||||
{:component-did-mount (fn []
|
{:component-did-mount #(re-frame/dispatch [::events/view-unpaid-invoices]) })])
|
||||||
(go
|
|
||||||
(->> (<! (http/get "/api/invoices/unpaid"))
|
|
||||||
:body
|
|
||||||
(conj [::events/received-invoices :unpaid])
|
|
||||||
(re-frame/dispatch))))})])
|
|
||||||
|
|
||||||
(defmethod active-page :paid-invoices []
|
(defmethod active-page :paid-invoices []
|
||||||
[:div {:class "inbox-messages"}
|
[:div {:class "inbox-messages"}
|
||||||
|
|||||||
Reference in New Issue
Block a user