fix(ui): 修复登录与并发请求并统一表格、主题和页面展示

验证:868 项单测、ESLint、Prettier、UI 依赖审计和差异检查通过。
This commit is contained in:
zhanjunhao
2026-11-19 18:58:46 +08:00
parent 9f5e0cddfb
commit e70e0d2224
128 changed files with 4672 additions and 5391 deletions
+10 -1
View File
@@ -198,12 +198,20 @@ const PageLayout = () => {
return;
}
const sessionAPI = API;
const isCurrentSession = () => {
const currentUser = getUserData();
return (
sessionAPI === API && currentUser?.id === cachedUser.id && !!currentUser
);
};
userDispatch({ type: 'auth_start' });
try {
const res = await API.get('/api/user/self', {
const res = await sessionAPI.get('/api/user/self', {
skipErrorHandler: true,
disableDuplicate: true,
});
if (!isCurrentSession()) return;
const { success, data } = res.data;
if (success && data) {
setUserData(data);
@@ -213,6 +221,7 @@ const PageLayout = () => {
userDispatch({ type: 'logout' });
}
} catch (error) {
if (!isCurrentSession()) return;
if (error?.response?.status === 401 || error?.response?.status === 403) {
clearUserData();
userDispatch({ type: 'logout' });