fix: 工单提交422错误处理 + SQL模板占位符校验
- TicketCreatePage: Pydantic 422 detail 是对象数组,前端错误处理改为检测数组并拼接 msg
- QueriesPage: 执行前检查 SQL 中未替换的 {table}/{db}/{collection} 占位符,阻止执行
- QueriesPage: 同步修复 422 detail 数组的错误处理
This commit is contained in:
1 parent
0aa4595c90
commit
ca99f0ea7f
2 files changed
+10
-3
No files matched your search
@@ -398,8 +398,10 @@ export default function TicketCreatePage() {
|
||||
});
|
||||
navigate('/tickets');
|
||||
} catch (e: unknown) {
|
||||
const err = e as { response?: { data?: { detail?: string } } };
|
||||
setError(err?.response?.data?.detail || '提交失败,请稍后重试');
|
||||
const err = e as { response?: { data?: { detail?: string | Array<{ msg: string }> } } };
|
||||
const raw = err?.response?.data?.detail;
|
||||
const msg = Array.isArray(raw) ? raw.map((v) => v.msg).join('; ') : (raw || '提交失败,请稍后重试');
|
||||
setError(msg);
|
||||
} finally { setSubmitting(false); }
|
||||
}, [title, sqlContent, instanceId, database, reason, priority, rollbackSql, instances, dbType, navigate]);
|
||||
|
||||
|
||||
Reference in new issue
Block a user