mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 19:51:09 -04:00
fix: dashboard ability issue
This commit is contained in:
@ -2,6 +2,21 @@
|
|||||||
import DashboardStats from '../dashboard/DashboardStats.vue'
|
import DashboardStats from '../dashboard/DashboardStats.vue'
|
||||||
import DashboardChart from '../dashboard/DashboardChart.vue'
|
import DashboardChart from '../dashboard/DashboardChart.vue'
|
||||||
import DashboardTable from '../dashboard/DashboardTable.vue'
|
import DashboardTable from '../dashboard/DashboardTable.vue'
|
||||||
|
import { useUserStore } from '@/scripts/stores/user'
|
||||||
|
import { onMounted } from 'vue'
|
||||||
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
|
|
||||||
|
const route = useRoute()
|
||||||
|
const userStore = useUserStore()
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
if (route.meta.ability && !userStore.hasAbilities(route.meta.ability)) {
|
||||||
|
router.push({ name: 'account.settings' })
|
||||||
|
} else if (route.meta.isOwner && !userStore.currentUser.is_owner) {
|
||||||
|
router.push({ name: 'account.settings' })
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
Reference in New Issue
Block a user