diff --git a/src/router/routes/lab.js b/src/router/routes/lab.js index b6503e82..20d42435 100644 --- a/src/router/routes/lab.js +++ b/src/router/routes/lab.js @@ -16,9 +16,7 @@ const labRoutes = [ component: () => import(/* webpackChunkName */ "@/views/Dashboard/Lab"), beforeEnter: (to, from, next) => { // Set drawer buttons here to make it dynamic :) - if (!store.state.substrate.isServicesExist || - store.state.substrate.labAccount.verificationStatus === "Unverified" && - (store.state.substrate.labAccount.stakeStatus === "Unstaked" && store.state.substrate.labAccount.stakeAmount === "0") + if (!store.state.substrate.isServicesExist || store.state.substrate.labAccount.verificationStatus === "Unverified" ) { to.meta.drawerButtons = [ { text: "Dashboard", active: true, disabled: false, route: { name: "lab-dashboard" } }, diff --git a/src/views/Dashboard/Lab/NavigationLayout.vue b/src/views/Dashboard/Lab/NavigationLayout.vue index 200c9607..f02ba4e1 100644 --- a/src/views/Dashboard/Lab/NavigationLayout.vue +++ b/src/views/Dashboard/Lab/NavigationLayout.vue @@ -38,7 +38,7 @@ @status-wallet="({status, img}) => connectWalletResult(status, img)" > - + @@ -141,11 +141,14 @@ export default { }, computeStakingStatus() { - return this.labAccount?.stakeStatus === "Unstaked" && this.labAccount.unstakeAt === "0" + return this.labAccount?.stakeStatus === "Unstaked" }, - verificationStatus() { - return this.labAccount?.verificationStatus + allowDashboard() { + if (this.isServicesExist) + if (this.labAccount?.stakeStatus === "Unstaked" && this.labAccount?.verificationStatus === "Unverified") return false + else return true + else return false } }, watch: { diff --git a/src/views/Dashboard/Lab/Registration/Services/index.vue b/src/views/Dashboard/Lab/Registration/Services/index.vue index 636c71d2..123e176e 100644 --- a/src/views/Dashboard/Lab/Registration/Services/index.vue +++ b/src/views/Dashboard/Lab/Registration/Services/index.vue @@ -433,48 +433,39 @@ export default { } }, - gotoDashboard() { + async gotoDashboard() { + await this.$store.dispatch("substrate/getLabAccount") this.$router.push({ name: "lab-dashboard" }) }, - async actionAlert() { - this.isSubmiting = true - const {labAccount} = await this.$store.dispatch("substrate/getLabAccount") - - if (this.isLabExist && labAccount.verificationStatus === "Unverified") { - await sendEmailRegisteredLab(this.wallet.address) - - await this.$store.dispatch("substrate/addAnyNotification", { - address: this.wallet.address, - dataAdd: { - message: "Congrats! You have been submitted your account verification.", - data: labAccount, - route: null, - params: null - }, - role: "lab" - }) - - this.dialogAlert = true - this.isSubmiting = false - } - - this.gotoDashboard() - }, - async handleStakeLab() { + this.isSubmiting = true this.stakeLoading = true try { await stakeLab(this.api, this.pair) - - this.actionAlert() - await this.$store.dispatch("substrate/getLabAccount") - this.gotoDashboard() + const {labAccount} = await this.$store.dispatch("substrate/getLabAccount") + + if (this.isLabExist && labAccount.verificationStatus === "Unverified") { + await sendEmailRegisteredLab(this.wallet.address) + + this.$store.dispatch("substrate/addAnyNotification", { + address: this.wallet.address, + dataAdd: { + message: "Congrats! You have been submitted your account verification.", + data: labAccount, + route: null, + params: null + }, + role: "lab" + }) + } + this.dialogAlert = true } catch (error) { console.error(error) } + this.isSubmiting = false this.stakeLoading = false }, diff --git a/src/views/Dashboard/Lab/index.vue b/src/views/Dashboard/Lab/index.vue index fd59183a..6dd01bea 100644 --- a/src/views/Dashboard/Lab/index.vue +++ b/src/views/Dashboard/Lab/index.vue @@ -24,8 +24,8 @@