feat(frontend): 对接后端统一响应格式,增强错误处理

- 新增 types/api.ts,定义 ApiResponse/PaginatedData 泛型类型和业务错误码常量
- 增强 request.ts 拦截器:提取后端错误信息、映射 HTTP 状态码和业务错误码为中文提示
- 为 auth/audit/subsystem API 添加泛型返回类型
- 为各视图添加 try/catch 防止未处理的 Promise 拒绝
This commit is contained in:
2026-07-15 10:52:41 +08:00
parent 4f1df02f53
commit 3de59c4fc2
10 changed files with 137 additions and 32 deletions
+1 -1
View File
@@ -97,7 +97,7 @@ const router = createRouter({
})
// 路由守卫
router.beforeEach((to, from, next) => {
router.beforeEach((to, _from, next) => {
const token = getToken()
if (to.meta.requiresAuth !== false && !token) {