Skip to content

Commit

Permalink
Merge pull request #10 from virtualidentityag/fix/TSYSTEMS-185-agency…
Browse files Browse the repository at this point in the history
…-data-privacy

fix(user-profile): specific legal pages
  • Loading branch information
koepferd authored Aug 20, 2024
2 parents 66e1162 + 78c5614 commit 77695ce
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/components/profile/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<
Expand All @@ -85,6 +87,18 @@ export const Profile = () => {
scrollContainer.current.scrollTo(0, 0);
}, [location]);

useEffect(() => {
// First agency can be set as only one session per asker is possible
// isSubsequentRegistrationAllowed false on consultingType
if (!hasUserAuthority(AUTHORITIES.CONSULTANT_DEFAULT, userData)) {
const specAgency = Object.values(userData.consultingTypes)?.filter(
(resort: any) =>
resort.isRegistered && resort.agency ? resort : null
);
setSpecificAgency(specAgency[0].agency);
}
}, [setSpecificAgency, userData]);

useEffect(() => {
setMobileMenu(
profileRoutes(settings, tenant, selectableLocales, isFirstVisit)
Expand Down

0 comments on commit 77695ce

Please sign in to comment.