Commit fd1b14fd authored by Edric Li's avatar Edric Li
Browse files

feat(home): redirect admin users to admin dashboard

When clicking "Enter Console" button on home page, admin users are now
redirected to /admin/dashboard instead of /dashboard.
parent eb198e59
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
<!-- Login / Dashboard Button --> <!-- Login / Dashboard Button -->
<router-link <router-link
v-if="isAuthenticated" v-if="isAuthenticated"
to="/dashboard" :to="dashboardPath"
class="inline-flex items-center gap-1.5 rounded-full bg-gray-900 py-1 pl-1 pr-2.5 transition-colors hover:bg-gray-800 dark:bg-gray-800 dark:hover:bg-gray-700" class="inline-flex items-center gap-1.5 rounded-full bg-gray-900 py-1 pl-1 pr-2.5 transition-colors hover:bg-gray-800 dark:bg-gray-800 dark:hover:bg-gray-700"
> >
<span <span
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
<!-- CTA Button --> <!-- CTA Button -->
<div> <div>
<router-link <router-link
:to="isAuthenticated ? '/dashboard' : '/login'" :to="isAuthenticated ? dashboardPath : '/login'"
class="btn btn-primary px-8 py-3 text-base shadow-lg shadow-primary-500/30" class="btn btn-primary px-8 py-3 text-base shadow-lg shadow-primary-500/30"
> >
{{ isAuthenticated ? t('home.goToDashboard') : t('home.getStarted') }} {{ isAuthenticated ? t('home.goToDashboard') : t('home.getStarted') }}
...@@ -416,6 +416,8 @@ const githubUrl = 'https://github.com/Wei-Shaw/sub2api' ...@@ -416,6 +416,8 @@ const githubUrl = 'https://github.com/Wei-Shaw/sub2api'
// Auth state // Auth state
const isAuthenticated = computed(() => authStore.isAuthenticated) const isAuthenticated = computed(() => authStore.isAuthenticated)
const isAdmin = computed(() => authStore.isAdmin)
const dashboardPath = computed(() => isAdmin.value ? '/admin/dashboard' : '/dashboard')
const userInitial = computed(() => { const userInitial = computed(() => {
const user = authStore.user const user = authStore.user
if (!user || !user.email) return '' if (!user || !user.email) return ''
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment