fix: linter error

This commit is contained in:
Junyan Qin
2025-05-30 22:29:16 +08:00
parent f17b06767e
commit 7e17c96c30
4 changed files with 18 additions and 14 deletions
@@ -25,11 +25,11 @@ export default function N8nAuthFormComponent({
}: { }: {
itemConfigList: IDynamicFormItemSchema[]; itemConfigList: IDynamicFormItemSchema[];
onSubmit?: (val: object) => unknown; onSubmit?: (val: object) => unknown;
initialValues?: Record<string, any>; initialValues?: Record<string, string>;
}) { }) {
// 当前选择的认证类型 // 当前选择的认证类型
const [authType, setAuthType] = useState<string>( const [authType, setAuthType] = useState<string>(
initialValues?.['auth-type'] || 'none' initialValues?.['auth-type'] || 'none',
); );
// 根据 itemConfigList 动态生成 zod schema // 根据 itemConfigList 动态生成 zod schema
@@ -111,7 +111,7 @@ export default function N8nAuthFormComponent({
acc[item.name] = initialValues[item.name] ?? item.default; acc[item.name] = initialValues[item.name] ?? item.default;
return acc; return acc;
}, },
{} as Record<string, any>, {} as Record<string, string>,
); );
Object.entries(mergedValues).forEach(([key, value]) => { Object.entries(mergedValues).forEach(([key, value]) => {
@@ -119,7 +119,7 @@ export default function N8nAuthFormComponent({
}); });
// 更新认证类型 // 更新认证类型
setAuthType(mergedValues['auth-type'] as string || 'none'); setAuthType((mergedValues['auth-type'] as string) || 'none');
} }
}, [initialValues, form, itemConfigList]); }, [initialValues, form, itemConfigList]);
@@ -138,7 +138,7 @@ export default function N8nAuthFormComponent({
acc[item.name] = formValues[item.name] ?? item.default; acc[item.name] = formValues[item.name] ?? item.default;
return acc; return acc;
}, },
{} as Record<string, any>, {} as Record<string, string>,
); );
onSubmit?.(finalValues); onSubmit?.(finalValues);
@@ -149,7 +149,11 @@ export default function N8nAuthFormComponent({
// 根据认证类型过滤表单项 // 根据认证类型过滤表单项
const filteredConfigList = itemConfigList.filter((config) => { const filteredConfigList = itemConfigList.filter((config) => {
// 始终显示webhook-url、auth-type、timeout和output-key // 始终显示webhook-url、auth-type、timeout和output-key
if (['webhook-url', 'auth-type', 'timeout', 'output-key'].includes(config.name)) { if (
['webhook-url', 'auth-type', 'timeout', 'output-key'].includes(
config.name,
)
) {
return true; return true;
} }
+4 -4
View File
@@ -203,10 +203,10 @@ export interface MarketPluginResponse {
} }
interface GetPipelineConfig { interface GetPipelineConfig {
ai: {}; ai: object;
output: {}; output: object;
safety: {}; safety: object;
trigger: {}; trigger: object;
} }
interface GetPipeline { interface GetPipeline {