V0.28.1.250618_alpha:修复定期的认证状态检查会关闭标签页的问题

This commit is contained in:
jinchao 2025-06-18 16:20:03 +08:00
parent b5d163be94
commit 346b34ee40
2 changed files with 6 additions and 6 deletions

Binary file not shown.

View File

@ -273,7 +273,7 @@
const contentArea = document.querySelector('content-area');
// 检查是否已登录
const checkAuth = async () => {
const checkAuth = async (isInterval = false) => {
try {
const response = await fetch('/api/check-auth', {
credentials: 'include'
@ -281,12 +281,12 @@
const result = await response.json();
if (result.success) {
// 先初始化主页面
initializeMainPage();
if (!isInterval) {
// 只有首次加载或主动调用时才初始化主页面
initializeMainPage();
}
authContainer.classList.remove('visible');
mainContainer.classList.add('visible');
// 触发一个自定义事件,通知其他组件登录成功
const loginSuccessEvent = new CustomEvent('login-success', {
detail: { user: result.user }
@ -713,7 +713,7 @@
// 每5分钟检查一次认证状态
setInterval(() => {
checkAuth();
checkAuth(true); // 传true表示定时检查
}, 5 * 60 * 1000); // 5分钟
});
</script>