19 lines
516 B
Vue
Raw Normal View History

<script lang="ts" setup>
2022-08-19 15:54:38 +08:00
import { ref } from "vue"
import { useUserStore } from "@/store/modules/user"
import AdminDashboard from "./admin/index.vue"
import EditorDashboard from "./editor/index.vue"
2022-08-19 15:54:38 +08:00
type CurrentRoleType = "admin" | "editor"
const userStore = useUserStore()
const currentRole = ref<CurrentRoleType>("admin")
if (!userStore.roles.includes("admin")) {
currentRole.value = "editor"
}
</script>
<template>
<component :is="currentRole === 'admin' ? AdminDashboard : EditorDashboard" />
</template>