you can now delete yodlee accounts again.
This commit is contained in:
@@ -203,56 +203,7 @@
|
||||
:on-success [::authenticated-mfa provider-account-id]
|
||||
:on-error [::forms/save-error [::mfa-form provider-account-id] ]}}))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::provider-account-refreshed
|
||||
(fn [{:keys [db]} [_ i result]]
|
||||
|
||||
{:db (assoc-in db [::provider-accounts] result)
|
||||
:dispatch [::forms/form-closing [::refresh-provider-account i]]}))
|
||||
|
||||
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::provider-account-deleted
|
||||
(fn [{:keys [db]} [_ i result]]
|
||||
{:db (assoc-in db [::provider-accounts] result)
|
||||
:dispatch-n [[::forms/form-closing [::refresh-provider-account i]]
|
||||
[::modal/modal-closed ]]}))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::delete-provider-account
|
||||
[with-user ]
|
||||
(fn [{:keys [user db]} [_ provider-account-id ]]
|
||||
{:http {:token user
|
||||
:method :post
|
||||
:owns-state {:single ::delete-provider-account}
|
||||
:headers {"Content-Type" "application/edn"}
|
||||
:uri (str "/api/yodlee2/provider-accounts/delete/" provider-account-id )
|
||||
:body {}
|
||||
:on-success [::provider-account-deleted provider-account-id]
|
||||
:on-error [::forms/save-error [::delete-provider-account provider-account-id] ]}}))
|
||||
|
||||
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::delete-requested
|
||||
[with-user]
|
||||
(fn [{:keys [user db]} [_ account-id]]
|
||||
{:dispatch
|
||||
[::modal/modal-requested {:title "Delete Provider account "
|
||||
:body [:div "Are you sure you want to delete provider account " account-id "?"]
|
||||
:confirm {:value "Delete provider account"
|
||||
:status-from [::status/single ::delete-provider-account]
|
||||
:class "is-danger"
|
||||
:on-click (dispatch-event [::delete-provider-account account-id])
|
||||
:close-event [::status/completed ::delete-provider-account]}
|
||||
:cancel? true}]}))
|
||||
|
||||
|
||||
(defn delete-button [account-id]
|
||||
[:button.button
|
||||
{:on-click (dispatch-event [::delete-requested account-id])}
|
||||
[:span.icon [:i.fa.fa-times]]])
|
||||
|
||||
(re-frame/reg-sub
|
||||
::bank-accounts-by-yodlee-account-id
|
||||
@@ -414,7 +365,7 @@
|
||||
(fn [{:keys [db]} _]
|
||||
{:dispatch [::data-requested]
|
||||
::forward/register {:id ::yodlee-account-refreshed
|
||||
:events #{::table/refreshed}
|
||||
:events #{::table/refreshed ::table/provider-account-deleted}
|
||||
:event-fn (fn [[_ query-result]]
|
||||
[::data-requested])}
|
||||
:db (dissoc db ::authentication)}))
|
||||
|
||||
@@ -3,9 +3,11 @@
|
||||
[auto-ap.subs :as subs]
|
||||
[auto-ap.views.components.buttons :as buttons]
|
||||
[auto-ap.views.components.grid :as grid]
|
||||
[auto-ap.views.components.modal :as modal]
|
||||
[auto-ap.views.pages.admin.users.form :as form]
|
||||
[auto-ap.views.utils :refer [action-cell-width date->str with-user ->$]]
|
||||
[re-frame.core :as re-frame]))
|
||||
[auto-ap.views.utils :refer [->$ action-cell-width date->str with-user dispatch-event]]
|
||||
[re-frame.core :as re-frame]
|
||||
[auto-ap.forms :as forms]))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::refreshed
|
||||
@@ -28,6 +30,40 @@
|
||||
:provider-account-id provider-account}
|
||||
:on-success [::refreshed provider-account]}}))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::provider-account-deleted
|
||||
(fn [{:keys [db]} [_ i result]]
|
||||
{:dispatch [::modal/modal-closed ]}))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::delete-provider-account
|
||||
[with-user ]
|
||||
(fn [{:keys [user db]} [_ provider-account-id ]]
|
||||
(comment :on-error [::forms/save-error [::delete-provider-account provider-account-id] ])
|
||||
{:http {:token user
|
||||
:method :post
|
||||
:owns-state {:single ::delete-provider-account}
|
||||
:headers {"Content-Type" "application/edn"}
|
||||
:uri (str "/api/yodlee2/provider-accounts/delete/" )
|
||||
:body {:client-id (:id @(re-frame/subscribe [::subs/client]))
|
||||
:provider-account-id provider-account-id}
|
||||
:on-success [::provider-account-deleted provider-account-id]
|
||||
}}))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::delete-requested
|
||||
[with-user]
|
||||
(fn [{:keys [user db]} [_ account-id]]
|
||||
{:dispatch
|
||||
[::modal/modal-requested {:title "Delete Provider account "
|
||||
:body [:div "Are you sure you want to delete provider account " account-id "?"]
|
||||
:confirm {:value "Delete provider account"
|
||||
:status-from [::status/single ::delete-provider-account]
|
||||
:class "is-danger"
|
||||
:on-click (dispatch-event [::delete-provider-account account-id])
|
||||
:close-event [::status/completed ::delete-provider-account]}
|
||||
:cancel? true}]}))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::params-changed
|
||||
(fn [{:keys [db]} [_ p]]
|
||||
@@ -75,4 +111,6 @@
|
||||
:icon "fa-pencil"}]
|
||||
[buttons/fa-icon {:event [::request-refresh (:id c)]
|
||||
:class (status/class-for (get statuses (:id c)))
|
||||
:icon "fa-refresh"}]]]])]]]))
|
||||
:icon "fa-refresh"}]
|
||||
[buttons/fa-icon {:event [::delete-requested (:id c)]
|
||||
:icon "fa-times"}]]]])]]]))
|
||||
|
||||
Reference in New Issue
Block a user