Skip to content

Commit

Permalink
fix(user-profile): specific legal pages
Browse files Browse the repository at this point in the history
TSYSTEMS-185
  • Loading branch information
koepferd committed Aug 16, 2024
1 parent 66e1162 commit 10201ec
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 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 @@ -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);
}, []);

Check warning on line 92 in src/components/profile/Profile.tsx

View workflow job for this annotation

GitHub Actions / ESLint

src/components/profile/Profile.tsx#L92

React Hook useEffect has missing dependencies: 'setSpecificAgency' and 'userData.consultingTypes'. Either include them or remove the dependency array (react-hooks/exhaustive-deps)

useEffect(() => {
Expand Down

0 comments on commit 10201ec

Please sign in to comment.