From 17c1c89639e7d3c59db53c7c8bc34a43af360c00 Mon Sep 17 00:00:00 2001 From: francis-fh Date: Wed, 17 Jun 2026 19:23:41 +0800 Subject: [PATCH] 1 --- src/pages/JobPortal/index.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/JobPortal/index.tsx b/src/pages/JobPortal/index.tsx index b168da6..b664e98 100644 --- a/src/pages/JobPortal/index.tsx +++ b/src/pages/JobPortal/index.tsx @@ -16,6 +16,7 @@ import { import { history } from '@umijs/max'; import { getJobTitleTreeSelect, getJobRecommend } from '@/services/common/jobTitle'; import { getGetInfoCache, saveGetInfoCache } from '@/utils/jobPortalAuth'; +import { getAccessToken } from '@/access'; import { getUserInfo } from '@/services/session'; import JobPortalHeader from '@/components/JobPortalHeader'; import './index.less'; @@ -144,7 +145,8 @@ const JobPortalPage: React.FC = () => { setJobTitles(cached); return; } - // 缓存不存在则请求 /api/getInfo 写入后再读取 + // 未登录用户不请求 /api/getInfo,避免 401 触发强制跳转登录页 + if (!getAccessToken()) return; getUserInfo({ skipErrorHandler: true }) .then((res: any) => { saveGetInfoCache(res as Record);