|
|
@@ -3,15 +3,21 @@ import store from '../states/store';
|
|
|
import { API_BASE_URL } from './config';
|
|
|
import { SystemMode } from '../states/systemModeSlice';
|
|
|
import emitter from '../utils/eventEmitter';
|
|
|
+import { throttleCount } from '@/utils/throttle';
|
|
|
|
|
|
const axiosInstance = axios.create({
|
|
|
baseURL: API_BASE_URL,
|
|
|
});
|
|
|
|
|
|
+function expensiveLog(mode) {
|
|
|
+ console.log(`当前系统模式:${mode}`);
|
|
|
+}
|
|
|
+const log = throttleCount(expensiveLog, 60);
|
|
|
+
|
|
|
axiosInstance.interceptors.request.use(
|
|
|
(config) => {
|
|
|
const state = store.getState();
|
|
|
- console.log(`当前系统模式:${state.systemMode.mode}`);
|
|
|
+ log(state.systemMode.mode);
|
|
|
|
|
|
const token =
|
|
|
state.systemMode.mode === SystemMode.Emergency
|