Skip to content

Commit

Permalink
Change import
Browse files Browse the repository at this point in the history
  • Loading branch information
timvanoostrom committed Dec 12, 2024
1 parent 6c49ad9 commit 4959c1e
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/client/pages/Vergunningen/useVergunningenTransformed.hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { defaultDateFormat } from '../../../universal/helpers/date';
import { getCustomTitleForVergunningWithLicensePlates } from '../../../universal/helpers/vergunningen';
import { AppState } from '../../../universal/types';
import { CaseType } from '../../../universal/types/vergunningen';
import { addTitleLinkComponent } from '../../components';
import { addTitleLinkComponent } from '../../components/Table/Table';

const titleTransformMap: Record<string, unknown> = {
[CaseType.TouringcarJaarontheffing]:
Expand All @@ -24,17 +24,15 @@ export function useVergunningenTransformed(
if (!VERGUNNINGEN.content?.length) {
return [];
}
const items: Vergunning[] = VERGUNNINGEN.content
.filter((x) => x)
.map((item) => {
const transformer = titleTransformMap[item.caseType];
return {
...item,
title:
typeof transformer === 'function' ? transformer(item) : item.title,
dateRequest: defaultDateFormat(item.dateRequest),
};
});
const items: Vergunning[] = VERGUNNINGEN.content.map((item) => {
const transformer = titleTransformMap[item.caseType];
return {
...item,
title:
typeof transformer === 'function' ? transformer(item) : item.title,
dateRequest: defaultDateFormat(item.dateRequest),
};
});
return addTitleLinkComponent(items, 'identifier');
}, [VERGUNNINGEN.content]);

Expand Down

0 comments on commit 4959c1e

Please sign in to comment.