From d03890263eb517e72190e81829ae07ead0f93ce9 Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Fri, 23 Feb 2024 08:24:57 +0100 Subject: [PATCH] use the right context (#27237) fixes: #27234 Signed-off-by: Erik Jan de Wit --- js/apps/account-ui/src/personal-info/PersonalInfo.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/js/apps/account-ui/src/personal-info/PersonalInfo.tsx b/js/apps/account-ui/src/personal-info/PersonalInfo.tsx index bf6a3c1ad5..6044d33c8e 100644 --- a/js/apps/account-ui/src/personal-info/PersonalInfo.tsx +++ b/js/apps/account-ui/src/personal-info/PersonalInfo.tsx @@ -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(); const [supportedLocales, setSupportedLocales] = useState([]); @@ -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={} 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", }) }