tracking companies by id
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
(ns auto-ap.events
|
||||
(:require [re-frame.core :as re-frame]
|
||||
[auto-ap.db :as db]
|
||||
[auto-ap.subs :as subs]
|
||||
[auto-ap.routes :as routes]
|
||||
[auto-ap.effects :as effects]
|
||||
[bidi.bidi :as bidi]))
|
||||
@@ -48,7 +49,7 @@
|
||||
(re-frame/reg-event-db
|
||||
::swap-company
|
||||
(fn [db [_ company]]
|
||||
(assoc db :company company)))
|
||||
(assoc db :company (:id company))))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::set-active-page
|
||||
@@ -69,8 +70,8 @@
|
||||
{:http {:method :post
|
||||
:token (-> cofx :db :user)
|
||||
:uri (str "/api/invoices/approve"
|
||||
(when-let [company-name (-> cofx :db :company :name)]
|
||||
(str "?company=" company-name)))
|
||||
(when-let [company-id (:id @(re-frame/subscribe [::subs/company]))]
|
||||
(str "?company=" company-id)))
|
||||
:on-success [::received-invoices :pending]
|
||||
}}))
|
||||
|
||||
@@ -81,8 +82,8 @@
|
||||
:http {:method :get
|
||||
:token (-> cofx :db :user)
|
||||
:uri (str "/api/invoices/pending"
|
||||
(when-let [company-name (-> cofx :db :company :name)]
|
||||
(str "?company=" company-name)))
|
||||
(when-let [company-id (:id @(re-frame/subscribe [::subs/company]))]
|
||||
(str "?company=" company-id)))
|
||||
:on-success [::received-invoices :pending]}}))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
@@ -92,8 +93,8 @@
|
||||
:http {:method :get
|
||||
:token (-> cofx :db :user)
|
||||
:uri (str "/api/invoices/unpaid"
|
||||
(when-let [company-name (-> cofx :db :company :name)]
|
||||
(str "?company=" company-name)))
|
||||
(when-let [company-id (:id @(re-frame/subscribe [::subs/company]))]
|
||||
(str "?company=" company-id)))
|
||||
:on-success [::received-invoices :unpaid]}}))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
@@ -102,8 +103,8 @@
|
||||
{:http {:method :post
|
||||
:token (-> cofx :db :user)
|
||||
:uri (str "/api/invoices/reject"
|
||||
(when-let [company-name (-> cofx :db :company :name)]
|
||||
(str "?company=" company-name)))
|
||||
(when-let [company-id (:id @(re-frame/subscribe [::subs/company]))]
|
||||
(str "?company=" company-id)))
|
||||
:on-success [::received-invoices :pending]
|
||||
}}))
|
||||
(re-frame/reg-event-db
|
||||
|
||||
Reference in New Issue
Block a user