|
|
@ -2,7 +2,7 @@ import type { Router } from 'vue-router'
|
|
|
|
import { useAuthStoreWithout } from '@/store/modules/auth'
|
|
|
|
import { useAuthStoreWithout } from '@/store/modules/auth'
|
|
|
|
|
|
|
|
|
|
|
|
export function setupPageGuard(router: Router) {
|
|
|
|
export function setupPageGuard(router: Router) {
|
|
|
|
router.beforeEach(async (from, to, next) => {
|
|
|
|
router.beforeEach(async (to, from, next) => {
|
|
|
|
const authStore = useAuthStoreWithout()
|
|
|
|
const authStore = useAuthStoreWithout()
|
|
|
|
if (!authStore.session) {
|
|
|
|
if (!authStore.session) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -12,7 +12,7 @@ export function setupPageGuard(router: Router) {
|
|
|
|
next()
|
|
|
|
next()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (error) {
|
|
|
|
catch (error) {
|
|
|
|
if (from.path !== '/500')
|
|
|
|
if (to.path !== '/500')
|
|
|
|
next({ name: '500' })
|
|
|
|
next({ name: '500' })
|
|
|
|
else
|
|
|
|
else
|
|
|
|
next()
|
|
|
|
next()
|
|
|
|