Template
1
0
mirror of https://github.com/un-pany/v3-admin-vite.git synced 2025-04-21 03:19:19 +08:00

refactor: dashboard view

This commit is contained in:
pany 2022-08-19 15:54:38 +08:00
parent 40e56047f7
commit 30694919b8

View File

@ -1,18 +1,16 @@
<script lang="ts" setup>
import { computed, onBeforeMount, ref } from "vue"
import { ref } from "vue"
import { useUserStore } from "@/store/modules/user"
import AdminDashboard from "./admin/index.vue"
import EditorDashboard from "./editor/index.vue"
const currentRole = ref("admin")
const roles = computed(() => {
return useUserStore().roles
})
onBeforeMount(() => {
if (!roles.value.includes("admin")) {
currentRole.value = "editor"
}
})
type CurrentRoleType = "admin" | "editor"
const userStore = useUserStore()
const currentRole = ref<CurrentRoleType>("admin")
if (!userStore.roles.includes("admin")) {
currentRole.value = "editor"
}
</script>
<template>