not using namespaced keys, due to graphql
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
[auto-ap.subs :as subs]
|
||||
[auto-ap.routes :as routes]
|
||||
[auto-ap.effects :as effects]
|
||||
[auto-ap.entities.companies :as companies]
|
||||
[bidi.bidi :as bidi]))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
@@ -43,14 +42,14 @@
|
||||
(fn [db [_ companies]]
|
||||
|
||||
(assoc db :companies (reduce (fn [companies company]
|
||||
(assoc companies (::companies/id company) company))
|
||||
(assoc companies (:id company) company))
|
||||
{}
|
||||
companies))))
|
||||
|
||||
(re-frame/reg-event-db
|
||||
::swap-company
|
||||
(fn [db [_ company]]
|
||||
(assoc db :company (::companies/id company))))
|
||||
(assoc db :company (:id company))))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::set-active-page
|
||||
@@ -71,7 +70,7 @@
|
||||
{:http {:method :post
|
||||
:token (-> cofx :db :user)
|
||||
:uri (str "/api/invoices/approve"
|
||||
(when-let [company-id (::companies/id @(re-frame/subscribe [::subs/company]))]
|
||||
(when-let [company-id (:id @(re-frame/subscribe [::subs/company]))]
|
||||
(str "?company=" company-id)))
|
||||
:on-success [::received-invoices :pending]
|
||||
}}))
|
||||
@@ -83,7 +82,7 @@
|
||||
:http {:method :get
|
||||
:token (-> cofx :db :user)
|
||||
:uri (str "/api/invoices/pending"
|
||||
(when-let [company-id (::companies/id @(re-frame/subscribe [::subs/company]))]
|
||||
(when-let [company-id (:id @(re-frame/subscribe [::subs/company]))]
|
||||
(str "?company=" company-id)))
|
||||
:on-success [::received-invoices :pending]}}))
|
||||
|
||||
@@ -94,7 +93,7 @@
|
||||
:http {:method :get
|
||||
:token (-> cofx :db :user)
|
||||
:uri (str "/api/invoices/unpaid"
|
||||
(when-let [company-id (::companies/id @(re-frame/subscribe [::subs/company]))]
|
||||
(when-let [company-id (:id @(re-frame/subscribe [::subs/company]))]
|
||||
(str "?company=" company-id)))
|
||||
:on-success [::received-invoices :unpaid]}}))
|
||||
|
||||
@@ -104,7 +103,7 @@
|
||||
{:http {:method :post
|
||||
:token (-> cofx :db :user)
|
||||
:uri (str "/api/invoices/reject"
|
||||
(when-let [company-id (::companies/id @(re-frame/subscribe [::subs/company]))]
|
||||
(when-let [company-id (:id @(re-frame/subscribe [::subs/company]))]
|
||||
(str "?company=" company-id)))
|
||||
:on-success [::received-invoices :pending]
|
||||
}}))
|
||||
|
||||
Reference in New Issue
Block a user