Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(user-profile): specific legal pages #10

Merged
merged 3 commits into from
Aug 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading