From 5b23354e350376f1720db95b739cd017b24ab9b8 Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Wed, 25 Aug 2021 15:22:53 +0200 Subject: [PATCH] changed to append to url, for client role details (#1048) fixes: #1041 --- src/realm-roles/RolesList.tsx | 2 +- src/realm-roles/routes/RealmRole.ts | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/realm-roles/RolesList.tsx b/src/realm-roles/RolesList.tsx index c0ec024bdc..86af146057 100644 --- a/src/realm-roles/RolesList.tsx +++ b/src/realm-roles/RolesList.tsx @@ -13,9 +13,9 @@ import { emptyFormatter, upperCaseFormatter } from "../util"; import { useRealm } from "../context/realm-context/RealmContext"; import type RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation"; import { HelpItem } from "../components/help-enabler/HelpItem"; +import { toRealmRole } from "./routes/RealmRole"; import "./RealmRolesSection.css"; -import { toRealmRole } from "./routes/RealmRole"; type myRealmRepresentation = RealmRepresentation & { defaultRole?: { diff --git a/src/realm-roles/routes/RealmRole.ts b/src/realm-roles/routes/RealmRole.ts index a36605bc28..51b05f99fa 100644 --- a/src/realm-roles/routes/RealmRole.ts +++ b/src/realm-roles/routes/RealmRole.ts @@ -1,5 +1,5 @@ import type { LocationDescriptorObject } from "history"; -import { generatePath } from "react-router-dom"; +import { useRouteMatch } from "react-router-dom"; import type { RouteDef } from "../../route-config"; import { RealmRoleTabs } from "../RealmRoleTabs"; @@ -24,6 +24,9 @@ export const RealmRoleRoute: RouteDef = { export const toRealmRole = ( params: RealmRoleParams -): LocationDescriptorObject => ({ - pathname: generatePath(RealmRoleRoute.path, params), -}); +): LocationDescriptorObject => { + const { url } = useRouteMatch(); + return { + pathname: `${url}/${params.id}/details`, + }; +};