Files
thebet365/apps/admin/src/i18n/form-validation.ts
Mars 3b739982a1 feat(admin): 从已有玩家升级代理、修复 i18n 与过期 .js 冲突
- 新建一级代理改为选择已有玩家;新建用户可选一级代理

- 操作日志/注单等扁平 key 翻译;清理 src 内误生成 .js,Vite 优先解析 .ts

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-03 15:42:15 +08:00

17 lines
496 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/** 表单校验错误key 对应 vue-i18n 文案) */
export class FormValidationError extends Error {
readonly key: string;
constructor(key: string) {
super(key);
this.name = 'FormValidationError';
this.key = key;
}
}
export function resolveFormError(e: unknown, t: (key: string) => string): string {
if (e instanceof FormValidationError) return t(e.key);
if (e instanceof Error && e.message.startsWith('err.')) return t(e.message);
return t('msg.form_invalid');
}