Skip to content

Commit

Permalink
Merge pull request #114 from virtualidentityag/fix/DIAKONIE-360-regis…
Browse files Browse the repository at this point in the history
…tration-agencyid

fix(agencyLanguages.tsx): enable agencyid in header for multitenancy
  • Loading branch information
koepferd authored Jun 27, 2024
2 parents fb3086d + 55d64fe commit 411a718
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
25 changes: 23 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
"devDependencies": {
"@babel/core": "^7.23.7",
"@babel/eslint-parser": "^7.23.3",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@commitlint/cli": "^18.5.0",
"@commitlint/config-conventional": "^18.5.0",
"@cypress/react": "^7.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,26 @@ import { useContext, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { apiAgencyLanguages } from '../../../../api/apiAgencyLanguages';
import { LanguagesContext } from '../../../../globalState/provider/LanguagesProvider';
import { useAppConfig } from '../../../../hooks/useAppConfig';

interface AgencyLanguagesProps {
agencyId?: number;
}

export const AgencyLanguages = ({ agencyId }: AgencyLanguagesProps) => {
const { t } = useTranslation();
const settings = useAppConfig();
const [languagesString, setLanguagesString] = useState<string>('');
const { fixed: fixedLanguages } = useContext(LanguagesContext);

useEffect(() => {
(async () => {
let languages = ['de'];
if (agencyId !== undefined) {
languages = await apiAgencyLanguages(agencyId, false).then(
languages = await apiAgencyLanguages(
agencyId,
settings?.multitenancyWithSingleDomainEnabled
).then(
(res) => (languages = [...fixedLanguages, ...res.languages])
);
}
Expand All @@ -37,7 +42,12 @@ export const AgencyLanguages = ({ agencyId }: AgencyLanguagesProps) => {
.join(' | ')
);
})();
}, [agencyId, fixedLanguages, t]);
}, [
agencyId,
fixedLanguages,
settings?.multitenancyWithSingleDomainEnabled,
t
]);

return (
<Typography variant="body2" sx={{ color: 'info.light' }}>
Expand Down

0 comments on commit 411a718

Please sign in to comment.