From 303fc0e0e2d8afbd3808f34e71743dfe2dbd83b7 Mon Sep 17 00:00:00 2001 From: Vadimus Date: Tue, 12 Sep 2023 13:22:05 +0300 Subject: [PATCH] OC-251 --- src/modules/wallet/pages/Withdrawal.vue | 42 ++++++------------------- src/store/core/actions.js | 4 +-- 2 files changed, 11 insertions(+), 35 deletions(-) diff --git a/src/modules/wallet/pages/Withdrawal.vue b/src/modules/wallet/pages/Withdrawal.vue index 6889c00..283563c 100644 --- a/src/modules/wallet/pages/Withdrawal.vue +++ b/src/modules/wallet/pages/Withdrawal.vue @@ -88,7 +88,6 @@ export default { return { selectedCoin: "", openedAction: "", - networksList: [], selectedDefault: this.$route?.params?.walletitem, openedActionProperties: {}, payout_form_view: "pending", @@ -161,11 +160,13 @@ export default { } }, }, - mounted() { - this.$store.dispatch("core/getCoinsLimits"); - this.loadWallets(); + async mounted() { + await Promise.all([ + this.$store.dispatch("core/getCoinsLimits"), + this.loadWallets(), + this.$store.dispatch("core/getUserNotifications"), + ]); this.showSecurityNotice(); - this.$store.dispatch("core/getUserNotifications"); if (this.isConnectedSocket) { if (localStorage.getItem("token")) { this.$store.dispatch( @@ -179,9 +180,7 @@ export default { this.getWalletHistory(); } } - setTimeout(() => { - this.coinSelected(this.$route?.params?.walletitem, this.coins); - }, 300); + this.cryptoWithdrawalClickHandler(this.$route?.params?.walletitem); }, beforeUnmount() { this.unsubscribeWsData(); @@ -200,29 +199,6 @@ export default { }); } }, - coinSelected(value, coins) { - if (coins) { - this.selectedCoin = { coin: value, ...coins[value] }; - } else { - this.selectedDefault = ""; - this.selectedCoin = { coin: value, ...this.filteredCoins[value] }; - } - this.networksList = {}; - if (typeof this.selectedCoin.is_fiat === "undefined") { - this.networksList[this.selectedCoin.coin] = { - id: this.selectedCoin.coin, - name: `${this.formatingCommission( - this.selectedCoin?.fee?.withdrawal.address - )} ${this.selectedCoin.coin}`, - action: () => - this.cryptoWithdrawalClickHandler(this.selectedCoin.coin), - }; - } - this.networksList[Object.values(this.networksList)[0].id].action(); - }, - networkSelected(id) { - this.networksList[id].action(); - }, blockchainCurrencyByCoin(coin) { return coin.blockchain_list ? coin.blockchain_list.map((code) => ({ @@ -363,8 +339,8 @@ export default { this.sendSocketMessage("del_balance", {}, false, true); this.sendSocketMessage("del_wallet_withdrawals_history", {}, false, true); }, - loadWallets() { - this.$http.post("getwallets/", {}).then((response) => { + async loadWallets() { + await this.$http.post("getwallets/", {}).then((response) => { response.data.forEach((wallet) => { if (!this.coins[wallet.currency]) { this.coins[wallet.currency] = {}; diff --git a/src/store/core/actions.js b/src/store/core/actions.js index 6532da3..2f030bb 100644 --- a/src/store/core/actions.js +++ b/src/store/core/actions.js @@ -38,8 +38,8 @@ export default { commit(mutationTypes.COINS_LIMITS_UPDATE, response); }); }, - getUserNotifications({ commit }) { - UserNotifications.get().then((response) => { + async getUserNotifications({ commit }) { + await UserNotifications.get().then((response) => { commit(mutationTypes.USER_NOTIFICATION, response); }); },