Merge pull request #965 from atmire/Issue-964-getEntityTypeByLabel-impl

issue 964 properly impl getEntityTypeByLabel
This commit is contained in:
Tim Donohue
2020-12-11 13:56:34 -06:00
committed by GitHub

View File

@@ -88,30 +88,10 @@ export class EntityTypeService extends DataService<ItemType> {
* @param label
*/
getEntityTypeByLabel(label: string): Observable<RemoteData<ItemType>> {
// TODO: Remove mock data once REST API supports this
/*
href$.pipe(take(1)).subscribe((href) => {
const request = new GetRequest(this.requestService.generateRequestId(), href);
this.requestService.configure(request);
});
return this.rdbService.buildSingle<EntityType>(href$);
*/
// Mock:
const index = [
'Publication',
'Person',
'Project',
'OrgUnit',
'Journal',
'JournalVolume',
'JournalIssue',
'DataPackage',
'DataFile',
].indexOf(label);
return this.findById((index + 1) + '');
return this.halService.getEndpoint(this.linkPath).pipe(
take(1),
switchMap((endPoint: string) =>
this.findByHref(endPoint + '/label/' + label))
);
}
}