mirror of
https://github.com/logto-io/logto.git
synced 2025-03-24 22:41:28 -05:00
refactor(console): fix connector guide form submit issue (#3481)
This commit is contained in:
parent
6bffd83cfc
commit
c312bd4d88
2 changed files with 6 additions and 6 deletions
|
@ -12,7 +12,7 @@ const Switch = ({ label, ...rest }: Props, ref?: Ref<HTMLInputElement>) => {
|
|||
<div className={styles.wrapper}>
|
||||
<div className={styles.label}>{label}</div>
|
||||
<label className={styles.switch}>
|
||||
<input type="checkbox" defaultChecked={false} {...rest} ref={ref} />
|
||||
<input type="checkbox" {...rest} ref={ref} />
|
||||
<span className={styles.slider} />
|
||||
</label>
|
||||
</div>
|
||||
|
|
|
@ -49,22 +49,22 @@ const ConfigForm = ({ formItems }: Props) => {
|
|||
const hasError = Boolean(errors[item.key]);
|
||||
const errorMessage = errors[item.key]?.message;
|
||||
|
||||
const commonProperties = {
|
||||
const buildCommonProperties = () => ({
|
||||
...register(item.key, { required: item.required }),
|
||||
placeholder: item.placeholder,
|
||||
hasError,
|
||||
};
|
||||
});
|
||||
|
||||
if (item.type === ConnectorConfigFormItemType.Text) {
|
||||
return <TextInput {...commonProperties} />;
|
||||
return <TextInput {...buildCommonProperties()} />;
|
||||
}
|
||||
|
||||
if (item.type === ConnectorConfigFormItemType.MultilineText) {
|
||||
return <Textarea rows={5} {...commonProperties} />;
|
||||
return <Textarea rows={5} {...buildCommonProperties()} />;
|
||||
}
|
||||
|
||||
if (item.type === ConnectorConfigFormItemType.Number) {
|
||||
return <TextInput type="number" {...commonProperties} />;
|
||||
return <TextInput type="number" {...buildCommonProperties()} />;
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
Loading…
Add table
Reference in a new issue