@@ -208,7 +208,6 @@
{{ $t("common.withdrawalprocessing") }}
-
{{ $t("common.checkyouremail") }}
{{ $t("common.continue") }}
@@ -216,31 +215,42 @@
-
-
-
-
-
+
+
+
+ {{ $t("common.getCode") }}
+ {{ $t("common.againAfter", { n: confirmEmailTimer }) }}
+
+
+
+
+
+
+
@@ -250,7 +260,6 @@ import { mapGetters } from "vuex";
import errorManager from "~/helpers/errorHundle";
import getFixedDecimal from "~/mixins/getFixedDecimal";
import accountSettingMixin from "~/modules/account/components/mixin";
-import phoneVerify from "~/components/PhoneVerify.vue";
import SelectAdvanced from "~/components/ui/SelectAdvanced.vue";
import getRegularNumber from "~/mixins/getRegularNumber";
@@ -258,7 +267,6 @@ export default {
name: "WalletWithdrawalCryptoAddress",
components: {
SelectAdvanced,
- phoneVerify,
},
mixins: [getFixedDecimal, accountSettingMixin, getRegularNumber],
props: {
@@ -271,6 +279,8 @@ export default {
emits: ["close"],
data() {
return {
+ confirmationCode: "",
+ confirmEmailTimer: 0,
lastWithdrawalAdresses: {},
destinationTag: "",
addrToPayMe: "",
@@ -353,6 +363,56 @@ export default {
}
},
methods: {
+ cancelWithdrawal() {
+ this.$http
+ .post("withdrawal/cancel-withdrawal-request", {
+ withdrawal_request_id: this.requestId,
+ })
+ .then(() => {
+ this.payout_form_view = "pending";
+ });
+ },
+
+ sendConfirmationCode() {
+ this.$http
+ .post("withdrawal/confirm-withdrawal-request", {
+ confirmation_token: this.confirmationCode,
+ })
+ .then(() => {
+ this.payout_form_view = "success";
+ })
+ .catch(() => {
+ this.$notify({
+ type: "error",
+ title: "",
+ text: this.$t("common.invalid_code"),
+ });
+ });
+ },
+
+ runConfirmEmailTimer() {
+ if (this.confirmEmailTimer > 0) return;
+
+ this.confirmEmailTimer = 180;
+
+ const interval = setInterval(() => {
+ this.confirmEmailTimer--;
+ if (this.confirmEmailTimer < 0) {
+ clearInterval(interval);
+ }
+ }, 1000);
+ },
+
+ resendCode() {
+ this.$http
+ .post("withdrawal/resend-withdrawal-request", {
+ withdrawal_request_id: this.requestId,
+ })
+ .then(() => {
+ this.runConfirmEmailTimer();
+ });
+ },
+
setMax() {
this.amountToPayMe = this.balance[this.ticker].actual;
},
@@ -384,7 +444,6 @@ export default {
this.addrToPayMe = addr;
},
payMe() {
- if (this.isBlockedByPhoneVerification) return;
let self = this;
if (
@@ -417,13 +476,16 @@ export default {
data["sms_code"] = this.sms_code;
}
this.$http.post("wallet_withdrawal/", data).then(
- () => {
- this.payout_form_view = "success";
+ (response) => {
this.amountToPayMe = "";
this.addrToPayMe = "";
setTimeout(function () {
self.$modal.close();
}, 3500);
+ this.payout_form_view = "confirm_by_email";
+ this.confirmationCode = "";
+ this.runConfirmEmailTimer();
+ this.requestId = response.data.id;
},
(err) => {
errorManager.parse(err, this, [
@@ -455,13 +517,6 @@ export default {
}
);
},
- goToWithdrawal() {
- if (this.profile.withdrawals_sms_confirmation) {
- this.payout_form_view = "confirm_by_sms";
- } else {
- this.payMe();
- }
- },
verifiedPhone(code) {
this.sms_code = code;
this.payout_form_view = "pending";
@@ -549,11 +604,19 @@ input.address {
line-height: 20px;
display: flex;
align-items: center;
+ justify-content: center;
letter-spacing: 0.05em;
text-transform: uppercase;
color: #ffffff;
padding: 0 50px;
}
+.withdrawal__btn_red {
+ background: #e34848;
+}
+.withdrawal__btn_yellow {
+ background: #ffba38;
+}
+
.withdrawal__btnIcon {
background-color: #fff;
mask: url("/public/img/withdrawal.svg") no-repeat center;
diff --git a/src/plugins/http.js b/src/plugins/http.js
index 311b288..9a5331e 100644
--- a/src/plugins/http.js
+++ b/src/plugins/http.js
@@ -88,10 +88,14 @@ export default (app) => {
error.response?.data?.code?.code === "token_not_valid"
) {
const originalRequest = error.config;
- await store.dispatch("core/refreshToken");
- originalRequest.headers["Authorization"] =
- "Bearer " + localStorage.getItem("token");
- return app.config.globalProperties.$http(originalRequest);
+ try {
+ await store.dispatch("core/refreshToken");
+ originalRequest.headers["Authorization"] =
+ "Bearer " + localStorage.getItem("token");
+ return app.config.globalProperties.$http(originalRequest);
+ } catch (e) {
+ console.log(e);
+ }
}
const pathname = window.location.pathname;
const matchNotAuthViews = noAuthRequireRoutes.find((route) =>
@@ -99,15 +103,15 @@ export default (app) => {
);
if (pathname !== "/" && !matchNotAuthViews) {
const lastPage = router.currentRoute.value.fullPath;
- if (lastPage) {
- if (
- error.response &&
- error.response?.data?.code?.code !== "token_not_valid"
- ) {
+ if (
+ error.response &&
+ error.response?.data?.code?.code === "token_not_valid"
+ ) {
+ if (lastPage) {
router.push({ name: "login", query: { redirectFrom: lastPage } });
+ } else {
+ router.push({ name: "login" });
}
- } else {
- router.push({ name: "login" });
}
}
}
diff --git a/src/router/index.js b/src/router/index.js
index 3a8521f..41394e8 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -63,7 +63,7 @@ let routes = [
},
{
name: "confirm-register",
- path: "/confirm-register/:token",
+ path: "/confirm-register",
component: lazyLoadView(
import("~/modules/account/pages/ConfirmRegister.vue")
),
diff --git a/src/store/core/actions.js b/src/store/core/actions.js
index 2f030bb..f999653 100644
--- a/src/store/core/actions.js
+++ b/src/store/core/actions.js
@@ -422,8 +422,9 @@ export default {
localStorage.setItem("token", response.data.access);
localStorage.setItem("refresh_token", response.data.refresh);
})
- .catch(() => {
+ .catch((e) => {
dispatch("logout");
+ return Promise.reject(e);
})
.finally(() => {
refreshTokenPromise = null;