feat: add local fallback for S3 writes
This commit is contained in:
@@ -8,6 +8,8 @@ const auth = useAuthStore()
|
||||
const router = useRouter()
|
||||
|
||||
const isLoggedIn = computed(() => auth.isLoggedIn)
|
||||
const consoleRoute = computed(() => (auth.user?.role === 'admin' ? '/admin' : '/dashboard'))
|
||||
const consoleLabel = computed(() => (auth.user?.role === 'admin' ? '管理后台' : '控制台'))
|
||||
|
||||
function logout() {
|
||||
auth.logout()
|
||||
@@ -35,10 +37,10 @@ function logout() {
|
||||
<div class="flex items-center gap-3">
|
||||
<template v-if="isLoggedIn">
|
||||
<RouterLink
|
||||
to="/dashboard"
|
||||
:to="consoleRoute"
|
||||
class="rounded-md border border-slate-200 bg-white px-3 py-1.5 text-sm text-slate-700 hover:bg-slate-50"
|
||||
>
|
||||
控制台
|
||||
{{ consoleLabel }}
|
||||
</RouterLink>
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -81,7 +81,7 @@ export function createAppRouter(pinia: Pinia) {
|
||||
}
|
||||
|
||||
if ((to.name === 'login' || to.name === 'register') && auth.isLoggedIn) {
|
||||
return { name: 'dashboard' }
|
||||
return { name: auth.user?.role === 'admin' ? 'admin' : 'dashboard' }
|
||||
}
|
||||
|
||||
if (to.meta?.requiresAdmin && auth.user?.role !== 'admin') {
|
||||
|
||||
Reference in New Issue
Block a user