diff --git a/src/views/dashboard/dashboard.vue b/src/views/dashboard/dashboard.vue index 46e3b3d..e8404e2 100644 --- a/src/views/dashboard/dashboard.vue +++ b/src/views/dashboard/dashboard.vue @@ -148,11 +148,13 @@ export default { } }, mounted() { - this.getMemberSummary() - this.getDailyPerformance() - this.getMonthlyPerformance() - this.getApprovalStatus() - this.userInfo = JSON.parse(localStorage.getItem('userInfo')) + this.getRoles().then(() => { + this.getMemberSummary() + this.getDailyPerformance() + this.getMonthlyPerformance() + this.getApprovalStatus() + this.userInfo = JSON.parse(localStorage.getItem('userInfo')) + }) }, methods: { getMemberSummary() { diff --git a/src/views/dashboard/mixins/top-bar-mixin.js b/src/views/dashboard/mixins/top-bar-mixin.js index 3c0705a..5007c2d 100644 --- a/src/views/dashboard/mixins/top-bar-mixin.js +++ b/src/views/dashboard/mixins/top-bar-mixin.js @@ -52,16 +52,21 @@ export default { }) }, getRoles() { - getRouters().then((res) => { - this.roleMenu = res.data || [] - if (!this.roleMenu.find((item) => item.routeName === 'summaryDashboard')) { - this.topList.splice(0, 1) - if (this.$route.name === 'summaryDashboard') { - this.$router.replace({ - name: 'Dashboard' - }) + return new Promise((resolve, reject) => { + getRouters().then((res) => { + this.roleMenu = res.data || [] + if (!this.roleMenu.find((item) => item.routeName === 'summaryDashboard')) { + this.topList.splice(0, 1) + if (this.$route.name === 'SummaryDashboard') { + this.$router.replace({ + name: 'Dashboard' + }) + } + reject() + return } - } + resolve() + }) }) } }