use the right context (#27237)

fixes: #27234

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
Erik Jan de Wit 2024-02-23 08:24:57 +01:00 committed by GitHub
parent cecce40aa5
commit d03890263e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,7 +8,6 @@ import {
} from "@patternfly/react-core";
import { ExternalLinkSquareAltIcon } from "@patternfly/react-icons";
import { TFunction } from "i18next";
import { useKeycloak } from "keycloak-masthead";
import { useState } from "react";
import { ErrorOption, useForm } from "react-hook-form";
import { useTranslation } from "react-i18next";
@ -36,7 +35,6 @@ import { usePromise } from "../utils/usePromise";
export const PersonalInfo = () => {
const { t } = useTranslation();
const context = useEnvironment();
const keycloak = useKeycloak();
const [userProfileMetadata, setUserProfileMetadata] =
useState<UserProfileMetadata>();
const [supportedLocales, setSupportedLocales] = useState<string[]>([]);
@ -72,7 +70,7 @@ export const PersonalInfo = () => {
console.warn("Error(s) loading locale", locale, error);
}
});
keycloak?.updateToken();
context.keycloak.updateToken();
addAlert(t("accountUpdatedMessage"));
} catch (error) {
addError(t("accountUpdatedError").toString());
@ -116,7 +114,7 @@ export const PersonalInfo = () => {
id="update-email-btn"
variant="link"
onClick={() =>
keycloak?.keycloak.login({ action: "UPDATE_EMAIL" })
context.keycloak.login({ action: "UPDATE_EMAIL" })
}
icon={<ExternalLinkSquareAltIcon />}
iconPosition="right"
@ -158,7 +156,7 @@ export const PersonalInfo = () => {
id="delete-account-btn"
variant="danger"
onClick={() =>
keycloak?.keycloak.login({
context.keycloak.login({
action: "delete_account",
})
}