fix: guard avatar entry and hide chat navigation

This commit is contained in:
stefanfeng
2026-07-24 17:50:19 +08:00
parent e3bda469bb
commit cc939b6298
2 changed files with 14 additions and 5 deletions
+4 -1
View File
@@ -1,5 +1,6 @@
import { createRouter, createWebHashHistory } from 'vue-router'
import type { RouteRecordRaw } from 'vue-router'
import { getAuthToken } from '@/api'
const routes: RouteRecordRaw[] = [
{
@@ -96,7 +97,9 @@ const router = createRouter({
router.beforeEach((to, from, next) => {
document.title = to.meta.title as string || '会会数字分身'
if (to.meta.requiresAuth && !localStorage.getItem('hh_app_token')) {
const hasLocalSession = Boolean(localStorage.getItem('hh_app_token'))
const hasInjectedSession = Boolean(getAuthToken())
if (to.meta.requiresAuth && !hasLocalSession && !hasInjectedSession) {
next({ path: '/login/sms', query: { redirect: to.fullPath } })
return
}