mirror of
https://github.com/rustfs/console.git
synced 2026-08-30 17:14:47 +08:00
c019276fcb
Signed-off-by: junxiang Mu <1948535941@qq.com>
17 lines
404 B
TypeScript
17 lines
404 B
TypeScript
export default defineNuxtRouteMiddleware((to, from) => {
|
|
const isAuthenticated = useAuth().isAuthenticated.value;
|
|
|
|
// 允许访问登录页面和配置页面
|
|
if (to.path === '/auth/login' || to.path === '/config') {
|
|
if (isAuthenticated && to.path === '/auth/login') {
|
|
return navigateTo('/');
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
if (!isAuthenticated) {
|
|
return navigateTo('/auth/login');
|
|
}
|
|
});
|