feat: integrate CampusSwitcher into header and API interceptor

This commit is contained in:
2026-07-06 00:06:35 +08:00
parent af3b4ba8f4
commit 80839607a4
2 changed files with 6 additions and 0 deletions

View File

@@ -10,6 +10,10 @@ api.interceptors.request.use((config) => {
if (token) {
config.headers.Authorization = `Bearer ${token}`;
}
const campusId = localStorage.getItem('currentCampusId');
if (campusId) {
config.headers['X-Campus-Id'] = campusId;
}
return config;
});

View File

@@ -27,6 +27,7 @@ import {
} from '@ant-design/icons';
import { usePermission } from '../hooks/usePermission';
import NotificationBell from '../components/NotificationBell';
import CampusSwitcher from '../components/CampusSwitcher';
const { Header, Sider, Content } = Layout;
@@ -265,6 +266,7 @@ const MainLayout: React.FC = () => {
)
}
onClick={() => (isMobile || isTablet ? setDrawerOpen(true) : setCollapsed(!collapsed))}
{isDesktop && <CampusSwitcher />}
<div style={{ display: 'flex', alignItems: 'center', gap: 16 }}>
<NotificationBell />
<Dropdown