keycloak-scim/js/apps/admin-ui/src/realm-settings/RealmSettingsSection.tsx

29 lines
998 B
TypeScript

import type RealmRepresentation from "@keycloak/keycloak-admin-client/lib/defs/realmRepresentation";
import { useState } from "react";
import { adminClient } from "../admin-client";
import { KeycloakSpinner } from "../components/keycloak-spinner/KeycloakSpinner";
import { useFetch } from "../context/auth/AdminClient";
import { useParams } from "../utils/useParams";
import { RealmSettingsTabs } from "./RealmSettingsTabs";
import type { RealmSettingsParams } from "./routes/RealmSettings";
export default function RealmSettingsSection() {
const { realm: realmName } = useParams<RealmSettingsParams>();
const [realm, setRealm] = useState<RealmRepresentation>();
const [key, setKey] = useState(0);
const refresh = () => {
setKey(key + 1);
setRealm(undefined);
};
useFetch(() => adminClient.realms.findOne({ realm: realmName }), setRealm, [
key,
]);
if (!realm) {
return <KeycloakSpinner />;
}
return <RealmSettingsTabs realm={realm} refresh={refresh} />;
}