[fix #2314] do not try to update wallet and transactions when offline
This commit is contained in:
parent
dc61971608
commit
156089b07b
|
@ -86,37 +86,39 @@
|
||||||
|
|
||||||
(handlers/register-handler-fx
|
(handlers/register-handler-fx
|
||||||
:update-wallet
|
:update-wallet
|
||||||
(fn [{{:keys [web3 accounts/current-account-id network] :as db} :db} [_ symbols]]
|
(fn [{{:keys [web3 accounts/current-account-id network network-status] :as db} :db} [_ symbols]]
|
||||||
{:get-balance {:web3 web3
|
(when-not (= network-status :offline)
|
||||||
:account-id current-account-id
|
{:get-balance {:web3 web3
|
||||||
:success-event :update-balance-success
|
:account-id current-account-id
|
||||||
:error-event :update-balance-fail}
|
:success-event :update-balance-success
|
||||||
:get-tokens-balance {:web3 web3
|
:error-event :update-balance-fail}
|
||||||
:account-id current-account-id
|
:get-tokens-balance {:web3 web3
|
||||||
:symbols symbols
|
:account-id current-account-id
|
||||||
:chain (ethereum/network->chain-keyword network)
|
:symbols symbols
|
||||||
:success-event :update-token-balance-success
|
:chain (ethereum/network->chain-keyword network)
|
||||||
:error-event :update-token-balance-fail}
|
:success-event :update-token-balance-success
|
||||||
:get-prices {:from "ETH"
|
:error-event :update-token-balance-fail}
|
||||||
:to "USD"
|
:get-prices {:from "ETH"
|
||||||
:success-event :update-prices-success
|
:to "USD"
|
||||||
:error-event :update-prices-fail}
|
:success-event :update-prices-success
|
||||||
:db (-> db
|
:error-event :update-prices-fail}
|
||||||
(clear-error-message :prices-update)
|
:db (-> db
|
||||||
(clear-error-message :balance-update)
|
(clear-error-message :prices-update)
|
||||||
(assoc-in [:wallet :balance-loading?] true)
|
(clear-error-message :balance-update)
|
||||||
(assoc :prices-loading? true))}))
|
(assoc-in [:wallet :balance-loading?] true)
|
||||||
|
(assoc :prices-loading? true))})))
|
||||||
|
|
||||||
(handlers/register-handler-fx
|
(handlers/register-handler-fx
|
||||||
:update-transactions
|
:update-transactions
|
||||||
(fn [{{:keys [accounts/current-account-id network] :as db} :db} _]
|
(fn [{{:keys [accounts/current-account-id network network-status] :as db} :db} _]
|
||||||
{:get-transactions {:account-id current-account-id
|
(when-not (= network-status :offline)
|
||||||
:network network
|
{:get-transactions {:account-id current-account-id
|
||||||
:success-event :update-transactions-success
|
:network network
|
||||||
:error-event :update-transactions-fail}
|
:success-event :update-transactions-success
|
||||||
:db (-> db
|
:error-event :update-transactions-fail}
|
||||||
(clear-error-message :transaction-update)
|
:db (-> db
|
||||||
(assoc-in [:wallet :transactions-loading?] true))}))
|
(clear-error-message :transaction-update)
|
||||||
|
(assoc-in [:wallet :transactions-loading?] true))})))
|
||||||
|
|
||||||
(handlers/register-handler-db
|
(handlers/register-handler-db
|
||||||
:update-transactions-success
|
:update-transactions-success
|
||||||
|
|
Loading…
Reference in New Issue