6
6
ListTemplateProps ,
7
7
Solid ,
8
8
TypedField ,
9
+ formatMessage ,
9
10
} from "@maykin-ui/admin-ui" ;
10
11
import React , { useCallback , useMemo } from "react" ;
11
12
import { useNavigation } from "react-router-dom" ;
@@ -25,6 +26,9 @@ import {
25
26
useZaakSelection ,
26
27
} from "../hooks/useZaakSelection" ;
27
28
29
+ /** The template used to format urls to an external application providing zaak details. */
30
+ const REACT_APP_ZAAK_URL_TEMPLATE = process . env . REACT_APP_ZAAK_URL_TEMPLATE ;
31
+
28
32
export type BaseListViewProps = React . PropsWithChildren < {
29
33
storageKey : string ;
30
34
title ?: string ;
@@ -80,6 +84,12 @@ export function BaseListView({
80
84
const [ , setFilterField ] = useFilter ( ) ;
81
85
const [ sort , setSort ] = useSort ( ) ;
82
86
87
+ // Object list.
88
+ const objectList = paginatedZaken . results . map ( ( zaak ) => ( {
89
+ ...zaak ,
90
+ href : formatMessage ( REACT_APP_ZAAK_URL_TEMPLATE || "" , zaak ) ,
91
+ } ) ) ;
92
+
83
93
// Fields.
84
94
const [ fields , setFields , filterTransform ] = useFields (
85
95
destructionList ,
@@ -176,7 +186,7 @@ export function BaseListView({
176
186
fields,
177
187
filterTransform,
178
188
loading : state === "loading" ,
179
- objectList : paginatedZaken . results as unknown as AttributeData [ ] ,
189
+ objectList : objectList ,
180
190
page,
181
191
sort : sort ,
182
192
selected : selectable
0 commit comments