mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-17 15:03:07 +00:00
64503: Fetch harvester endpoint using halService + small unsubscribe fix
This commit is contained in:
@@ -421,6 +421,8 @@ export class CollectionSourceComponent extends AbstractTrackableComponent implem
|
|||||||
* Make sure open subscriptions are closed
|
* Make sure open subscriptions are closed
|
||||||
*/
|
*/
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
this.updateSub.unsubscribe();
|
if (this.updateSub) {
|
||||||
|
this.updateSub.unsubscribe();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
import { filter, map, take, tap } from 'rxjs/operators';
|
import { filter, map, switchMap, take, tap } from 'rxjs/operators';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
|
|
||||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||||
@@ -80,7 +80,7 @@ export class CollectionDataService extends ComColDataService<Collection> {
|
|||||||
*/
|
*/
|
||||||
getHarvesterEndpoint(collectionId: string): Observable<string> {
|
getHarvesterEndpoint(collectionId: string): Observable<string> {
|
||||||
return this.halService.getEndpoint(this.linkPath).pipe(
|
return this.halService.getEndpoint(this.linkPath).pipe(
|
||||||
map((href: string) => `${href}/${collectionId}/harvester`)
|
switchMap((href: string) => this.halService.getEndpoint('harvester', `${href}/${collectionId}`))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -43,8 +43,8 @@ export class HALEndpointService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getEndpoint(linkPath: string): Observable<string> {
|
public getEndpoint(linkPath: string, startHref?: string): Observable<string> {
|
||||||
return this.getEndpointAt(this.getRootHref(), ...linkPath.split('/'));
|
return this.getEndpointAt(startHref || this.getRootHref(), ...linkPath.split('/'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user