|
|
@@ -32,17 +32,17 @@ onMounted(async () => {
|
|
|
|
|
|
// 清除 URL 中的参数,然后导航到聊天页面
|
|
|
window.history.replaceState({}, '', '/chat');
|
|
|
- router.push('/chat');
|
|
|
+ router.replace('/chat');
|
|
|
} catch (error) {
|
|
|
console.error('Token verification failed:', error);
|
|
|
router.push('/');
|
|
|
}
|
|
|
} else if (!userStore.userId) {
|
|
|
// 如果没有 token 且用户未登录,跳转到登录页
|
|
|
- router.push('/');
|
|
|
+ router.replace('/');
|
|
|
} else {
|
|
|
// 用户已登录,跳转到聊天页面
|
|
|
- router.push('/chat');
|
|
|
+ router.replace('/chat');
|
|
|
}
|
|
|
});
|
|
|
</script>
|