feat: 实现安全存储和批量导入功能增强

refactor(前端): 重构认证和存储逻辑使用secureStorage
feat(前端): 添加安全存储工具和日志工具
feat(前端): 增强批量导入功能支持服务器和交换机设备
fix(后端): 改进设备端口和网卡批量导入接口
docs: 更新导入模板和操作说明
This commit is contained in:
zhangbing
2026-03-29 10:06:32 +08:00
parent 63f0cb570e
commit 1d815b812e
22 changed files with 1326 additions and 214 deletions
+4 -3
View File
@@ -1,5 +1,6 @@
import axios from 'axios';
import { API_CONFIG } from '../config/api';
import secureStorage, { TOKEN_KEY } from '../utils/secureStorage';
const api = axios.create({
baseURL: API_CONFIG.baseURL,
@@ -11,7 +12,7 @@ const api = axios.create({
api.interceptors.request.use(
config => {
const token = localStorage.getItem('token');
const token = secureStorage.get(TOKEN_KEY);
if (token) {
config.headers.Authorization = `Bearer ${token}`;
}
@@ -47,8 +48,8 @@ api.interceptors.response.use(
const currentPath = window.location.pathname;
if (!currentPath.startsWith('/login')) {
localStorage.removeItem('token');
localStorage.removeItem('user');
secureStorage.remove(TOKEN_KEY);
secureStorage.remove('user');
window.location.href = '/login';
}
}