fix(player): 修复登录页「继续浏览」跳转到需登录页的死循环
跳过登录时仅允许进入首页、投注页或赛事详情等公开页面,避免 redirect 指向钱包/个人中心时被路由守卫拦截而停留在登录页。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -39,9 +39,17 @@ async function submit() {
|
||||
}
|
||||
}
|
||||
|
||||
function isGuestBrowsablePath(path: string): boolean {
|
||||
if (!path || path === '/' || path === '/bet') return true;
|
||||
if (path.startsWith('/match/')) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function continueBrowsing() {
|
||||
const redirect = (route.query.redirect as string) || '/';
|
||||
router.push(redirect);
|
||||
const redirect = typeof route.query.redirect === 'string' ? route.query.redirect : '';
|
||||
// redirect 是登录成功后的目标;跳过登录时只能去公开页,避免跳回需登录页形成死循环
|
||||
const target = isGuestBrowsablePath(redirect) ? redirect || '/' : '/';
|
||||
router.replace(target);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user