refactor: dashboard view
This commit is contained in:
parent
40e56047f7
commit
30694919b8
@ -1,18 +1,16 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, onBeforeMount, ref } from "vue"
|
import { ref } from "vue"
|
||||||
import { useUserStore } from "@/store/modules/user"
|
import { useUserStore } from "@/store/modules/user"
|
||||||
import AdminDashboard from "./admin/index.vue"
|
import AdminDashboard from "./admin/index.vue"
|
||||||
import EditorDashboard from "./editor/index.vue"
|
import EditorDashboard from "./editor/index.vue"
|
||||||
|
|
||||||
const currentRole = ref("admin")
|
type CurrentRoleType = "admin" | "editor"
|
||||||
const roles = computed(() => {
|
|
||||||
return useUserStore().roles
|
const userStore = useUserStore()
|
||||||
})
|
const currentRole = ref<CurrentRoleType>("admin")
|
||||||
onBeforeMount(() => {
|
if (!userStore.roles.includes("admin")) {
|
||||||
if (!roles.value.includes("admin")) {
|
|
||||||
currentRole.value = "editor"
|
currentRole.value = "editor"
|
||||||
}
|
}
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user