Added refresh after generate and update (#3514)

This commit is contained in:
Erik Jan de Wit 2022-10-11 13:08:47 +02:00 committed by GitHub
parent b928418da1
commit 3374780a1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -54,6 +54,8 @@ export const Keys = ({ clientId, save, hasConfigureAccess }: KeysProps) => {
const [openGenerateKeys, toggleOpenGenerateKeys, setOpenGenerateKeys] = const [openGenerateKeys, toggleOpenGenerateKeys, setOpenGenerateKeys] =
useToggle(); useToggle();
const [openImportKeys, toggleOpenImportKeys, setOpenImportKeys] = useToggle(); const [openImportKeys, toggleOpenImportKeys, setOpenImportKeys] = useToggle();
const [key, setKey] = useState(0);
const refresh = () => setKey(key + 1);
const useJwksUrl = useWatch({ const useJwksUrl = useWatch({
control, control,
@ -64,7 +66,7 @@ export const Keys = ({ clientId, save, hasConfigureAccess }: KeysProps) => {
useFetch( useFetch(
() => adminClient.clients.getKeyInfo({ id: clientId, attr }), () => adminClient.clients.getKeyInfo({ id: clientId, attr }),
(info) => setKeyInfo(info), (info) => setKeyInfo(info),
[] [key]
); );
const generate = async (config: KeyStoreConfig) => { const generate = async (config: KeyStoreConfig) => {
@ -81,6 +83,7 @@ export const Keys = ({ clientId, save, hasConfigureAccess }: KeysProps) => {
`keystore.${config.format == "PKCS12" ? "p12" : "jks"}` `keystore.${config.format == "PKCS12" ? "p12" : "jks"}`
); );
addAlert(t("generateSuccess"), AlertVariant.success); addAlert(t("generateSuccess"), AlertVariant.success);
refresh();
} catch (error) { } catch (error) {
addError("clients:generateError", error); addError("clients:generateError", error);
} }
@ -100,6 +103,7 @@ export const Keys = ({ clientId, save, hasConfigureAccess }: KeysProps) => {
formData formData
); );
addAlert(t("importSuccess"), AlertVariant.success); addAlert(t("importSuccess"), AlertVariant.success);
refresh();
} catch (error) { } catch (error) {
addError("clients:importError", error); addError("clients:importError", error);
} }