@@ -61,53 +61,56 @@ export class PersonsComponent implements OnInit {
61
61
if ( authors ) {
62
62
typeId = PictureItemType . PICTURE_ITEM_AUTHOR ;
63
63
}
64
- return this . #itemsClient. list (
65
- new ItemsRequest ( {
66
- fields : new ItemFields ( {
67
- description : true ,
68
- hasText : true ,
69
- nameDefault : true ,
70
- nameHtml : true ,
71
- previewPictures : new PreviewPicturesRequest ( {
72
- pictures : new PicturesRequest ( {
73
- options : new PictureListOptions ( {
74
- pictureItem : new PictureItemListOptions ( { typeId} ) ,
75
- status : PictureStatus . PICTURE_STATUS_ACCEPTED ,
64
+ return this . #itemsClient
65
+ . list (
66
+ new ItemsRequest ( {
67
+ fields : new ItemFields ( {
68
+ description : true ,
69
+ hasText : true ,
70
+ nameDefault : true ,
71
+ nameHtml : true ,
72
+ previewPictures : new PreviewPicturesRequest ( {
73
+ pictures : new PicturesRequest ( {
74
+ options : new PictureListOptions ( {
75
+ pictureItem : new PictureItemListOptions ( { typeId} ) ,
76
+ status : PictureStatus . PICTURE_STATUS_ACCEPTED ,
77
+ } ) ,
76
78
} ) ,
77
79
} ) ,
78
80
} ) ,
79
- } ) ,
80
- language : this . #languageService . language ,
81
- limit : 10 ,
82
- options : new ItemListOptions ( {
83
- descendant : new ItemParentCacheListOptions ( {
84
- pictureItemsByItemId : new PictureItemListOptions ( {
85
- pictures : new PictureListOptions ( { status : PictureStatus . PICTURE_STATUS_ACCEPTED } ) ,
86
- typeId ,
81
+ language : this . #languageService . language ,
82
+ limit : 10 ,
83
+ options : new ItemListOptions ( {
84
+ descendant : new ItemParentCacheListOptions ( {
85
+ pictureItemsByItemId : new PictureItemListOptions ( {
86
+ pictures : new PictureListOptions ( { status : PictureStatus . PICTURE_STATUS_ACCEPTED } ) ,
87
+ typeId ,
88
+ } ) ,
87
89
} ) ,
90
+ typeId : ItemType . ITEM_TYPE_PERSON ,
88
91
} ) ,
89
- typeId : ItemType . ITEM_TYPE_PERSON ,
92
+ order : ItemsRequest . Order . NAME ,
93
+ page,
90
94
} ) ,
91
- order : ItemsRequest . Order . NAME ,
92
- page,
93
- } ) ,
94
- ) ;
95
- } ) ,
96
- catchError ( ( error : unknown ) => {
97
- this . #toastService. handleError ( error ) ;
98
- return EMPTY ;
95
+ )
96
+ . pipe (
97
+ catchError ( ( error : unknown ) => {
98
+ this . #toastService. handleError ( error ) ;
99
+ return EMPTY ;
100
+ } ) ,
101
+ map ( ( response ) => ( {
102
+ items : this . prepareItems ( response . items || [ ] , authors ) ,
103
+ paginator : response . paginator ,
104
+ } ) ) ,
105
+ ) ;
99
106
} ) ,
100
- map ( ( response ) => ( {
101
- items : this . prepareItems ( response . items || [ ] ) ,
102
- paginator : response . paginator ,
103
- } ) ) ,
104
107
) ;
105
108
106
109
ngOnInit ( ) : void {
107
110
setTimeout ( ( ) => this . #pageEnv. set ( { pageId : 214 } ) , 0 ) ;
108
111
}
109
112
110
- private prepareItems ( items : APIItem [ ] ) : CatalogueListItem [ ] {
113
+ private prepareItems ( items : APIItem [ ] , authors : boolean ) : CatalogueListItem [ ] {
111
114
return items . map ( ( item ) : CatalogueListItem => {
112
115
const itemRouterLink = [ '/persons' ] ;
113
116
itemRouterLink . push ( item . id ) ;
@@ -119,7 +122,11 @@ export class PersonsComponent implements OnInit {
119
122
let routerLink : string [ ] = [ ] ;
120
123
if ( picture . picture ) {
121
124
thumb = largeFormat && idx == 0 ? picture . picture . thumbLarge : picture . picture . thumbMedium ;
122
- routerLink = itemRouterLink . concat ( [ picture . picture . identity ] ) ;
125
+ if ( authors ) {
126
+ routerLink = itemRouterLink . concat ( [ 'author' , picture . picture . identity ] ) ;
127
+ } else {
128
+ routerLink = itemRouterLink . concat ( [ picture . picture . identity ] ) ;
129
+ }
123
130
}
124
131
return { picture : picture . picture || null , routerLink, thumb} ;
125
132
} ) ;
0 commit comments