From fbe3986a57774e795175e2ef393d3c24378eff53 Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Wed, 9 Jun 2021 09:09:59 +0200 Subject: [PATCH] fixed default value and link to settings on create (#657) --- src/client-scopes/details/ScopeForm.tsx | 8 +++++--- src/client-scopes/form/ClientScopeForm.tsx | 10 +++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/client-scopes/details/ScopeForm.tsx b/src/client-scopes/details/ScopeForm.tsx index 1494bb1bc5..71c48b40e9 100644 --- a/src/client-scopes/details/ScopeForm.tsx +++ b/src/client-scopes/details/ScopeForm.tsx @@ -33,7 +33,9 @@ type ScopeFormProps = { export const ScopeForm = ({ clientScope, save }: ScopeFormProps) => { const { t } = useTranslation("client-scopes"); - const { register, control, handleSubmit, errors, setValue } = useForm(); + const { register, control, handleSubmit, errors, setValue } = useForm< + ClientScopeRepresentation + >({ defaultValues: { attributes: { "display-on-consent-screen": "true" } } }); const history = useHistory(); const { realm } = useRealm(); @@ -202,7 +204,7 @@ export const ScopeForm = ({ clientScope, save }: ScopeFormProps) => { ( { ( { const { t } = useTranslation("client-scopes"); const [clientScope, setClientScope] = useState< ClientScopeDefaultOptionalType >(); + const history = useHistory(); + const { realm } = useRealm(); const [hide, setHide] = useState(false); const adminClient = useAdminClient(); @@ -118,6 +121,11 @@ export const ClientScopeForm = () => { { ...clientScopes, id: scope.id }, clientScopes.type ); + history.push( + `/${realm}/client-scopes/${scope.id}/${ + clientScopes.type || "none" + }/settings` + ); } addAlert(t((id ? "update" : "create") + "Success"), AlertVariant.success); } catch (error) {