From 16f74a429ee38e086b86baa0c962225c7bca4691 Mon Sep 17 00:00:00 2001 From: elsiosanchez <45974454+elsiosanchez@users.noreply.github.com> Date: Tue, 28 Jan 2020 18:03:39 -0400 Subject: [PATCH] support dashboards associated to the selected role (#280) --- src/views/dashboard/admin/index.vue | 21 ++++++++++++-------- src/views/profile/components/RolesNavbar.vue | 1 + 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/views/dashboard/admin/index.vue b/src/views/dashboard/admin/index.vue index 87c44de0..842f3265 100644 --- a/src/views/dashboard/admin/index.vue +++ b/src/views/dashboard/admin/index.vue @@ -28,6 +28,14 @@ export default { computed: { getterDashboard() { return this.$store.getters.getDashboardByRole(this.roleUuid) + }, + getterRol() { + return this.$store.getters.getRoleUuid + } + }, + watch: { + getterRol(value) { + this.getDashboardListFromServer() } }, mounted() { @@ -35,14 +43,11 @@ export default { }, methods: { getDashboardListFromServer() { - if (this.getterDashboard) { - this.dashboardList = this.getterDashboard.dashboardList - } else { - this.$store.dispatch('listDashboard', this.roleUuid) - .then(response => { - this.dashboardList = response.dashboardsList - }) - } + this.$store.dispatch('listDashboard') + .then(response => { + this.dashboardList = response.dashboardsList + this.$forceUpdate() + }) } } } diff --git a/src/views/profile/components/RolesNavbar.vue b/src/views/profile/components/RolesNavbar.vue index 22545695..10e3f8ca 100644 --- a/src/views/profile/components/RolesNavbar.vue +++ b/src/views/profile/components/RolesNavbar.vue @@ -62,6 +62,7 @@ export default { }) this.$store.dispatch('user/changeRoles', valueSelected) .then(response => { + this.$store.dispatch('listDashboard', response.uuid) this.showMessage({ message: this.$t('notifications.successChangeRole'), type: 'success'