2022-04-21 18:20:39 +08:00
|
|
|
<script lang="ts" setup>
|
2022-08-19 15:54:38 +08:00
|
|
|
import { ref } from "vue"
|
2022-04-22 12:47:04 +08:00
|
|
|
import { useUserStore } from "@/store/modules/user"
|
2022-04-22 01:16:02 +08:00
|
|
|
import AdminDashboard from "./admin/index.vue"
|
|
|
|
import EditorDashboard from "./editor/index.vue"
|
2022-04-21 18:20:39 +08:00
|
|
|
|
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"
|
|
|
|
}
|
2022-04-21 18:20:39 +08:00
|
|
|
</script>
|
2022-04-22 12:47:04 +08:00
|
|
|
|
|
|
|
<template>
|
|
|
|
<component :is="currentRole === 'admin' ? AdminDashboard : EditorDashboard" />
|
|
|
|
</template>
|