fixed msg error when clientScope created with whitespace (#1997) (#2162)

This commit is contained in:
ikhomyn 2022-03-06 16:26:52 +01:00 committed by GitHub
parent ca350380fb
commit cf695626a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -78,7 +78,11 @@ export const ScopeForm = ({ clientScope, save }: ScopeFormProps) => {
helperTextInvalid={t("common:required")} helperTextInvalid={t("common:required")}
> >
<TextInput <TextInput
ref={register({ required: true })} ref={register({
required: true,
validate: (value: string) =>
!!value.trim() || t("common:required").toString(),
})}
type="text" type="text"
id="kc-name" id="kc-name"
name="name" name="name"

View file

@ -106,7 +106,7 @@ export default function ClientScopeForm() {
const save = async (clientScopes: ClientScopeDefaultOptionalType) => { const save = async (clientScopes: ClientScopeDefaultOptionalType) => {
try { try {
clientScopes.name = clientScopes.name?.trim(); clientScopes.name = clientScopes.name?.trim().replace(/ /g, "_");
clientScopes = convertFormValuesToObject( clientScopes = convertFormValuesToObject(
clientScopes clientScopes
) as ClientScopeDefaultOptionalType; ) as ClientScopeDefaultOptionalType;