keycloak-scim/src/realm-settings/RealmSettingsSection.tsx

28 lines
918 B
TypeScript
Raw Normal View History

2021-09-29 08:51:47 +00:00
import React, { useState } from "react";
import type RealmRepresentation from "@keycloak/keycloak-admin-client/lib/defs/realmRepresentation";
import { KeycloakSpinner } from "../components/keycloak-spinner/KeycloakSpinner";
import { useAdminClient, useFetch } from "../context/auth/AdminClient";
import { useRealm } from "../context/realm-context/RealmContext";
import { RealmSettingsTabs } from "./RealmSettingsTabs";
2021-10-29 16:11:06 +00:00
export default function RealmSettingsSection() {
const adminClient = useAdminClient();
const { realm: realmName } = useRealm();
const [realm, setRealm] = useState<RealmRepresentation>();
const [key, setKey] = useState(0);
const refresh = () => {
setKey(key + 1);
};
useFetch(() => adminClient.realms.findOne({ realm: realmName }), setRealm, [
key,
]);
if (!realm) {
return <KeycloakSpinner />;
}
return <RealmSettingsTabs realm={realm} refresh={refresh} />;
2021-10-29 16:11:06 +00:00
}