0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-03-31 22:51:25 -05:00

refactor(console): add error state to create role and permission form (#2978)

This commit is contained in:
Xiao Yijun 2023-01-18 11:52:18 +08:00 committed by GitHub
parent 993298792d
commit 3f1faf4784
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -86,6 +86,7 @@ const CreatePermissionModal = ({ resourceId, onClose }: Props) => {
<TextInput
placeholder={t('api_resource_details.permission.description_placeholder')}
{...register('description', { required: true })}
hasError={Boolean(errors.description)}
/>
</FormField>
</form>

View file

@ -28,7 +28,7 @@ const CreateRoleForm = ({ onClose }: Props) => {
control,
handleSubmit,
register,
formState: { isSubmitting },
formState: { isSubmitting, errors },
} = useForm<CreateRoleFormData>();
const api = useApi();
@ -72,12 +72,14 @@ const CreateRoleForm = ({ onClose }: Props) => {
autoFocus
{...register('name', { required: true })}
placeholder={t('roles.role_name_placeholder')}
hasError={Boolean(errors.name)}
/>
</FormField>
<FormField isRequired title="roles.role_description">
<TextInput
{...register('description', { required: true })}
placeholder={t('roles.role_description_placeholder')}
hasError={Boolean(errors.description)}
/>
</FormField>
<FormField title="roles.assign_permissions">