mirror of
https://github.com/logto-io/logto.git
synced 2025-03-10 22:22:45 -05:00
fix(console): error state for connector form (#2594)
This commit is contained in:
parent
bbf54216fe
commit
121a240b1f
1 changed files with 10 additions and 2 deletions
|
@ -20,7 +20,11 @@ type Props = {
|
||||||
const ConnectorForm = ({ connector }: Props) => {
|
const ConnectorForm = ({ connector }: Props) => {
|
||||||
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
|
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
|
||||||
const { configTemplate, isStandard } = connector;
|
const { configTemplate, isStandard } = connector;
|
||||||
const { control, register } = useFormContext<ConnectorFormType>();
|
const {
|
||||||
|
control,
|
||||||
|
register,
|
||||||
|
formState: { errors },
|
||||||
|
} = useFormContext<ConnectorFormType>();
|
||||||
const [darkVisible, setDarkVisible] = useState(false);
|
const [darkVisible, setDarkVisible] = useState(false);
|
||||||
|
|
||||||
const toggleDarkVisible = () => {
|
const toggleDarkVisible = () => {
|
||||||
|
@ -45,6 +49,7 @@ const ConnectorForm = ({ connector }: Props) => {
|
||||||
<FormField isRequired title="connectors.guide.name">
|
<FormField isRequired title="connectors.guide.name">
|
||||||
<TextInput
|
<TextInput
|
||||||
placeholder={t('connectors.guide.name')}
|
placeholder={t('connectors.guide.name')}
|
||||||
|
hasError={Boolean(errors.name)}
|
||||||
{...register('name', { required: true })}
|
{...register('name', { required: true })}
|
||||||
/>
|
/>
|
||||||
<div className={styles.tip}>{t('connectors.guide.name_tip')}</div>
|
<div className={styles.tip}>{t('connectors.guide.name_tip')}</div>
|
||||||
|
@ -76,7 +81,10 @@ const ConnectorForm = ({ connector }: Props) => {
|
||||||
onClick={toggleDarkVisible}
|
onClick={toggleDarkVisible}
|
||||||
/>
|
/>
|
||||||
<FormField isRequired title="connectors.guide.target">
|
<FormField isRequired title="connectors.guide.target">
|
||||||
<TextInput {...register('target', { required: true })} />
|
<TextInput
|
||||||
|
hasError={Boolean(errors.target)}
|
||||||
|
{...register('target', { required: true })}
|
||||||
|
/>
|
||||||
<div className={styles.tip}>{t('connectors.guide.target_tip')}</div>
|
<div className={styles.tip}>{t('connectors.guide.target_tip')}</div>
|
||||||
</FormField>
|
</FormField>
|
||||||
</>
|
</>
|
||||||
|
|
Loading…
Add table
Reference in a new issue