feat(frontend): 对接后端统一响应格式,增强错误处理
- 新增 types/api.ts,定义 ApiResponse/PaginatedData 泛型类型和业务错误码常量 - 增强 request.ts 拦截器:提取后端错误信息、映射 HTTP 状态码和业务错误码为中文提示 - 为 auth/audit/subsystem API 添加泛型返回类型 - 为各视图添加 try/catch 防止未处理的 Promise 拒绝
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user