init auth
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import Button from 'primevue/button'
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const authStore = useAuthStore()
|
||||
|
||||
const handleLogout = () => {
|
||||
localStorage.removeItem('auth_code')
|
||||
authStore.logout()
|
||||
router.push('/login')
|
||||
}
|
||||
|
||||
@@ -18,14 +20,22 @@ const isActive = (path) => {
|
||||
return route.path.startsWith(path)
|
||||
}
|
||||
|
||||
const navItems = [
|
||||
{ path: '/', icon: '🏠', tooltip: 'Home' },
|
||||
{ path: '/assets', icon: '📂', tooltip: 'Assets' },
|
||||
{ path: '/generation', icon: '🎨', tooltip: 'Image Generation' },
|
||||
{ path: '/flexible-generation', icon: '🖌️', tooltip: 'Flexible Generation' },
|
||||
{ path: '/characters', icon: '👥', tooltip: 'Characters' },
|
||||
{ path: '/image-to-prompt', icon: '✨', tooltip: 'Image to Prompt' }
|
||||
]
|
||||
const navItems = computed(() => {
|
||||
const items = [
|
||||
{ path: '/', icon: '🏠', tooltip: 'Home' },
|
||||
{ path: '/assets', icon: '📂', tooltip: 'Assets' },
|
||||
// { path: '/generation', icon: '🎨', tooltip: 'Image Generation' },
|
||||
{ path: '/flexible', icon: '🖌️', tooltip: 'Flexible Generation' },
|
||||
{ path: '/characters', icon: '👥', tooltip: 'Characters' },
|
||||
{ path: '/image-to-prompt', icon: '✨', tooltip: 'Image to Prompt' }
|
||||
]
|
||||
|
||||
if (authStore.isAdmin()) {
|
||||
items.push({ path: '/admin/approvals', icon: '🛡️', tooltip: 'Approvals' })
|
||||
}
|
||||
|
||||
return items
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user