1405/05/29-add tv page
This commit is contained in:
+15
-4
@@ -33,8 +33,17 @@ export function setupRouterGuards() {
|
||||
}
|
||||
}
|
||||
|
||||
function isGuestAllowed(to: RouteLocationNormalized) {
|
||||
if (to.meta?.public) {
|
||||
return true
|
||||
}
|
||||
return ['login', '404', 'buyProduct', 'productDetail', 'about', 'cart', 'tvMonitor'].includes(
|
||||
to.name as string,
|
||||
)
|
||||
}
|
||||
|
||||
function goToLogin(to: RouteLocationNormalized, next: NavigationGuardNext) {
|
||||
if (to.name === 'buyProduct' || to.name === 'productDetail' || to.name === 'about' || to.name === 'cart' || to.name === 'tv') {
|
||||
if (isGuestAllowed(to)) {
|
||||
return next()
|
||||
}
|
||||
if (to.name !== 'login') {
|
||||
@@ -53,7 +62,9 @@ export function setupRouterGuards() {
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
authStore.setLoading(true)
|
||||
clearFingerTimeout()
|
||||
setFingerTimeOut(to)
|
||||
if (to.name !== 'tvMonitor' && !to.meta?.hideChrome) {
|
||||
setFingerTimeOut(to)
|
||||
}
|
||||
|
||||
if (to.name === 'notifyTrigger' && getToken()) {
|
||||
const { useSettingsStore } = await import('@/store/settingsStore')
|
||||
@@ -112,7 +123,7 @@ export function setupRouterGuards() {
|
||||
return next()
|
||||
}
|
||||
} else {
|
||||
if (['login', '404', 'buyProduct', 'productDetail', 'about', 'cart', 'tv'].includes(to.name as string)) {
|
||||
if (isGuestAllowed(to)) {
|
||||
return next()
|
||||
}
|
||||
goToLogin(to, next)
|
||||
@@ -126,7 +137,7 @@ export function setupRouterGuards() {
|
||||
return next()
|
||||
}
|
||||
|
||||
if (['login', '404', 'buyProduct', 'productDetail', 'about', 'cart', 'tv'].includes(to.name as string)) {
|
||||
if (isGuestAllowed(to)) {
|
||||
return next()
|
||||
}
|
||||
return next({ name: 'login' })
|
||||
|
||||
Reference in New Issue
Block a user