19 lines
508 B
Vue
Raw Normal View History

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