@@ -2,21 +2,23 @@ import { AxiosResponse } from 'axios'
22import { License } from '../../models/License'
33import { LicensePayload } from './LicensePayload'
44
5- export const transformPayloadToLicense = ( response : AxiosResponse ) : License [ ] => {
5+ export const transformPayloadToLicenses = ( response : AxiosResponse ) : License [ ] => {
66 const payload = response . data . data as LicensePayload [ ]
77
8- return payload . map ( ( license : LicensePayload ) => ( {
9- id : license . id ,
10- name : license . name ,
11- shortDescription : license . shortDescription ,
12- uri : license . uri ,
13- iconUri : license . iconUrl , // in payload, it is called iconUrl, but iconUri is the name matching everywhere else
14- active : license . active ,
15- isDefault : license . isDefault ,
16- sortOrder : license . sortOrder ,
17- rightsIdentifier : license . rightsIdentifier ,
18- rightsIdentifierScheme : license . rightsIdentifierScheme ,
19- schemeUri : license . schemeUri ,
20- languageCode : license . languageCode
21- } ) )
8+ return payload . map ( ( license : LicensePayload ) => transformPayloadLicenseToLicense ( license ) )
229}
10+
11+ export const transformPayloadLicenseToLicense = ( license : LicensePayload ) : License => ( {
12+ id : license . id ,
13+ name : license . name ,
14+ shortDescription : license . shortDescription ,
15+ uri : license . uri ,
16+ iconUri : license . iconUrl , // in payload, it is called iconUrl, but iconUri is the name matching everywhere else
17+ active : license . active ,
18+ isDefault : license . isDefault ,
19+ sortOrder : license . sortOrder ,
20+ rightsIdentifier : license . rightsIdentifier ,
21+ rightsIdentifierScheme : license . rightsIdentifierScheme ,
22+ schemeUri : license . schemeUri ,
23+ languageCode : license . languageCode
24+ } )
0 commit comments