fixed urls (#489)

fixing: #454
This commit is contained in:
Erik Jan de Wit 2021-04-01 08:36:14 +02:00 committed by GitHub
parent e0e6f677c6
commit c503663e4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 9 deletions

View file

@ -20,6 +20,7 @@ import { useAlerts } from "../../components/alert/Alerts";
import { AddMapperDialog } from "../add/MapperDialog";
import { useAdminClient } from "../../context/auth/AdminClient";
import { KeycloakDataTable } from "../../components/table-toolbar/KeycloakDataTable";
import { useRealm } from "../../context/realm-context/RealmContext";
type MapperListProps = {
clientScope: ClientScopeRepresentation;
@ -36,8 +37,10 @@ export const MapperList = ({ clientScope, refresh }: MapperListProps) => {
const { t } = useTranslation("client-scopes");
const adminClient = useAdminClient();
const { addAlert } = useAlerts();
const history = useHistory();
const { url } = useRouteMatch();
const { realm } = useRealm();
const url = `/${realm}/client-scopes/${clientScope.id}/mappers`;
const [mapperAction, setMapperAction] = useState(false);
const mapperList = clientScope.protocolMappers!;

View file

@ -35,6 +35,7 @@ import { HelpItem } from "../../components/help-enabler/HelpItem";
import { useServerInfo } from "../../context/server-info/ServerInfoProvider";
import { convertFormValuesToObject, convertToFormValues } from "../../util";
import { FormAccess } from "../../components/form-access/FormAccess";
import { useRealm } from "../../context/realm-context/RealmContext";
type Params = {
id: string;
@ -56,8 +57,8 @@ export const MappingDetails = () => {
>();
const history = useHistory();
const { realm } = useRealm();
const serverInfo = useServerInfo();
const { url } = useRouteMatch();
const isGuid = /^[{]?[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}[}]?$/;
useEffect(() => {
@ -114,12 +115,12 @@ export const MappingDetails = () => {
continueButtonVariant: ButtonVariant.danger,
onConfirm: async () => {
try {
await adminClient.clientScopes.delClientScopeMappings(
{ client: id, id: mapperId },
[]
);
await adminClient.clientScopes.delProtocolMapper({
id,
mapperId: mapperId,
});
addAlert(t("mappingDeletedSuccess"), AlertVariant.success);
history.push(`${url}/${id}`);
history.push(`/${realm}/client-scopes/${id}/mappers`);
} catch (error) {
addAlert(t("mappingDeletedError", { error }), AlertVariant.danger);
}

View file

@ -93,13 +93,13 @@ export const routes: RoutesFn = (t: TFunction) => [
access: "manage-clients",
},
{
path: "/:realm/client-scopes/:id/:tab/oidc-role-name-mapper",
path: "/:realm/client-scopes/:id/mappers/oidc-role-name-mapper",
component: RoleMappingForm,
breadcrumb: t("client-scopes:mappingDetails"),
access: "view-clients",
},
{
path: "/:realm/client-scopes/:id/:tab/:mapperId",
path: "/:realm/client-scopes/:id/mappers/:mapperId",
component: MappingDetails,
breadcrumb: t("client-scopes:mappingDetails"),
access: "view-clients",