From 10201ecb4b039d86e30d074051d084f2e17b5290 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Deborah=20K=C3=B6pfer?= Date: Fri, 16 Aug 2024 15:30:15 +0200 Subject: [PATCH] fix(user-profile): specific legal pages TSYSTEMS-185 --- src/components/profile/Profile.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/profile/Profile.tsx b/src/components/profile/Profile.tsx index 8c724ab71..8e3bde34a 100644 --- a/src/components/profile/Profile.tsx +++ b/src/components/profile/Profile.tsx @@ -61,7 +61,9 @@ export const Profile = () => { const legalLinks = useContext(LegalLinksContext); const { userData } = useContext(UserDataContext); - const { specificAgency } = useContext(AgencySpecificContext); + const { specificAgency, setSpecificAgency } = useContext( + AgencySpecificContext + ); const { consultingTypes } = useContext(ConsultingTypesContext); const [mobileMenu, setMobileMenu] = useState< @@ -79,6 +81,14 @@ export const Profile = () => { .querySelector('.navigation__wrapper') ?.classList.remove('navigation__wrapper--mobileHidden'); document.querySelector('.header')?.classList.remove('header--mobile'); + + // First agency can be set as only one session per asker is possible + // isSubsequentRegistrationAllowed false on consultingType + const specAgency = Object.values(userData.consultingTypes).filter( + (resort: any) => + resort.isRegistered && resort.agency ? resort : null + ); + setSpecificAgency(specAgency[0].agency); }, []); useEffect(() => {