Skip to content

Commit

Permalink
Merge pull request #92 from virtualidentityag/feat/DIAKONIE-273-add-p…
Browse files Browse the repository at this point in the history
…ostcode-fallback-url

feat: use fallbackUrl from topic
  • Loading branch information
janrembold authored Apr 18, 2024
2 parents 1040c0a + 9305e87 commit 9b57218
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export const AgencySelection: VFC<{
onNextClick={onNextClick}
zipcode={headlineZipcode}
results={agencies}
fallbackUrl={registrationData?.mainTopic?.fallbackUrl}
/>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ import { useTranslation } from 'react-i18next';
import { RegistrationContext, RegistrationData } from '../../../../globalState';
import { AgencyDataInterface } from '../../../../globalState/interfaces';
import { AgencyLanguages } from './AgencyLanguages';
import { parsePlaceholderString } from '../../../../utils/parsePlaceholderString';
import { useAppConfig } from '../../../../hooks/useAppConfig';
import { MetaInfo } from '../metaInfo/MetaInfo';
import { REGISTRATION_DATA_VALIDATION } from '../registrationDataValidation';
import { UrlParamsContext } from '../../../../globalState/provider/UrlParamsProvider';
Expand All @@ -36,6 +34,7 @@ interface AgencySelectionResultsProps {
zipcode?: string;
results?: AgencyDataInterface[];
nextStepUrl: string;
fallbackUrl: string;
onNextClick(): void;
}

Expand All @@ -44,10 +43,10 @@ export const AgencySelectionResults = ({
zipcode,
results,
nextStepUrl,
fallbackUrl,
onNextClick
}: AgencySelectionResultsProps) => {
const { t } = useTranslation();
const settings = useAppConfig();
const { setDisabledNextButton, registrationData } =
useContext(RegistrationContext);
const { consultant: preselectedConsultant } = useContext(UrlParamsContext);
Expand Down Expand Up @@ -145,17 +144,10 @@ export const AgencySelectionResults = ({
startIcon={<OpenInNewIcon />}
target="_blank"
component={Link}
// TODO: Add fallback URL from Tenant
href={
settings?.postcodeFallbackUrl
? parsePlaceholderString(
settings.postcodeFallbackUrl,
{
url: 'https://fallbackURL.de',
postcode: zipcode
}
)
: 'https://fallbackURL.de'
fallbackUrl
? `${fallbackUrl}${zipcode}/`
: 'https://www.diakonie.de'
}
>
{t('registration.agency.noresult.label')}
Expand Down
1 change: 1 addition & 0 deletions src/globalState/interfaces/TopicsDataInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface TopicsDataInterface {
status: string;
createDate: string;
updateDate: string;
fallbackUrl: string;
titles: {
short: string;
long: string;
Expand Down

0 comments on commit 9b57218

Please sign in to comment.