forked from wangziqi/gongxue-base
feat: integrate CampusSwitcher into header and API interceptor
This commit is contained in:
@@ -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;
|
||||
});
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user