mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-28 08:44:41 +08:00
feat(provider): add required field validation with toast notifications
- Add validation for provider name (required for all providers) - Add validation for API endpoint and API Key (required for non-official providers) - Use toast notifications instead of inline form errors for better visibility - Move name validation from zod schema to handleSubmit for consistent UX - Add i18n keys: endpointRequired, apiKeyRequired
This commit is contained in:
@@ -36,7 +36,7 @@ function parseJsonError(error: unknown): string {
|
||||
}
|
||||
|
||||
export const providerSchema = z.object({
|
||||
name: z.string().min(1, "请填写供应商名称"),
|
||||
name: z.string(), // 必填校验移至 handleSubmit 中用 toast 提示
|
||||
websiteUrl: z.string().url("请输入有效的网址").optional().or(z.literal("")),
|
||||
notes: z.string().optional(),
|
||||
settingsConfig: z
|
||||
|
||||
Reference in New Issue
Block a user