diff --git a/src/realm-settings/ClientProfileForm.tsx b/src/realm-settings/ClientProfileForm.tsx index 3d575e290c..670bf5bb7d 100644 --- a/src/realm-settings/ClientProfileForm.tsx +++ b/src/realm-settings/ClientProfileForm.tsx @@ -284,7 +284,7 @@ export default function ClientProfileForm() { component={(props) => ( )} data-testid={"cancelCreateProfile"} @@ -466,7 +466,7 @@ export default function ClientProfileForm() { component={(props) => ( )} variant="primary" diff --git a/src/realm-settings/NewClientPolicyCondition.tsx b/src/realm-settings/NewClientPolicyCondition.tsx index 64f11d5288..e9226e2b4f 100644 --- a/src/realm-settings/NewClientPolicyCondition.tsx +++ b/src/realm-settings/NewClientPolicyCondition.tsx @@ -194,9 +194,7 @@ export default function NewClientPolicyCondition() { policies: updatedPolicies, }); setPolicies(updatedPolicies); - history.push( - `/${realm}/realm-settings/clientPolicies/${policyName}/edit-policy` - ); + history.push(toEditClientPolicy({ realm, policyName })); addAlert( conditionName ? t("realm-settings:updateClientConditionSuccess") diff --git a/src/realm-settings/NewClientPolicyForm.tsx b/src/realm-settings/NewClientPolicyForm.tsx index f29c544454..24b036c6a4 100644 --- a/src/realm-settings/NewClientPolicyForm.tsx +++ b/src/realm-settings/NewClientPolicyForm.tsx @@ -36,7 +36,10 @@ import type ClientPolicyRepresentation from "@keycloak/keycloak-admin-client/lib import { toNewClientPolicyCondition } from "./routes/AddCondition"; import { useServerInfo } from "../context/server-info/ServerInfoProvider"; import { toEditClientPolicyCondition } from "./routes/EditCondition"; -import type { EditClientPolicyParams } from "./routes/EditClientPolicy"; +import { + EditClientPolicyParams, + toEditClientPolicy, +} from "./routes/EditClientPolicy"; import { AddClientProfileModal } from "./AddClientProfileModal"; import type ClientProfileRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientProfileRepresentation"; import { toClientPolicies } from "./routes/ClientPolicies"; @@ -245,7 +248,7 @@ export default function NewClientPolicyForm() { AlertVariant.success ); history.push( - `/${realm}/realm-settings/clientPolicies/${createdForm.name}/edit-policy` + toEditClientPolicy({ realm, policyName: createdForm.name! }) ); setShowAddConditionsAndProfilesForm(true); } catch (error) { @@ -299,7 +302,7 @@ export default function NewClientPolicyForm() { }); addAlert(t("deleteConditionSuccess"), AlertVariant.success); history.push( - `/${realm}/realm-settings/clientPolicies/${formValues.name}/edit-policy` + toEditClientPolicy({ realm, policyName: formValues.name! }) ); } catch (error) { addError(t("deleteConditionError"), error); @@ -344,7 +347,7 @@ export default function NewClientPolicyForm() { }); addAlert(t("deleteClientPolicyProfileSuccess"), AlertVariant.success); history.push( - `/${realm}/realm-settings/clientPolicies/${formValues.name}/edit-policy` + toEditClientPolicy({ realm, policyName: formValues.name! }) ); } catch (error) { addError(t("deleteClientPolicyProfileError"), error); @@ -407,9 +410,7 @@ export default function NewClientPolicyForm() { policies: newPolicies, }); setPolicies(newPolicies); - history.push( - `/${realm}/realm-settings/clientPolicies/${formValues.name}/edit-policy` - ); + history.push(toEditClientPolicy({ realm, policyName: formValues.name! })); addAlert( t("realm-settings:addClientProfileSuccess"), AlertVariant.success