Skip to content

Commit 7d108bf

Browse files
[DSC-1940] refactor
1 parent cc54e40 commit 7d108bf

2 files changed

Lines changed: 12 additions & 14 deletions

File tree

src/app/audit-page/object-audit-overview/object-audit-overview.component.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,14 @@ export class ObjectAuditOverviewComponent implements OnInit {
8585
redirectOn4xx(this.router, this.authService)
8686
).subscribe((rd) => {
8787
this.object = rd.payload;
88-
this.owningCollection$ = this.collectionDataService.findOwningCollectionFor(this.object).pipe(
88+
this.owningCollection$ = this.collectionDataService.findOwningCollectionFor(
89+
this.object,
90+
true,
91+
false,
92+
...COLLECTION_PAGE_LINKS_TO_FOLLOW
93+
).pipe(
8994
getFirstCompletedRemoteData(),
90-
map(data => data.payload),
91-
switchMap((collection) => this.collectionDataService.findById(
92-
collection.id,
93-
false,
94-
false,
95-
...COLLECTION_PAGE_LINKS_TO_FOLLOW
96-
).pipe(
97-
getFirstCompletedRemoteData(),
98-
map(data => data.payload),
99-
)
100-
)
95+
map(data => data?.payload)
10196
);
10297
this.setAudits();
10398
});

src/app/core/data/collection-data.service.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,12 @@ export class CollectionDataService extends ComColDataService<Collection> {
321321
/**
322322
* Returns {@link RemoteData} of {@link Collection} that is the owning collection of the given item
323323
* @param item Item we want the owning collection of
324+
* @param useCachedVersionIfAvailable
325+
* @param reRequestOnStale
326+
* @param linksToFollow
324327
*/
325-
findOwningCollectionFor(item: Item): Observable<RemoteData<Collection>> {
326-
return this.findByHref(item._links.owningCollection.href);
328+
findOwningCollectionFor(item: Item, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<Collection>[]): Observable<RemoteData<Collection>> {
329+
return this.findByHref(item._links.owningCollection.href, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
327330
}
328331

329332
/**

0 commit comments

Comments
 (0)