[Library | new-theme]:
1. orcid.service.ts: [Bug fix] In method "getOrcidWorks()", updated response type from <any[]> to <any> --> "bulk" object with an array inside is returned. 2. orcid-work.component.ts: [Bug fix] In method "getOrcidWorks()", parsing of bulk works fixed to not have problem when null response or error object inside bulk is returned.
This commit is contained in:
parent
65eb622653
commit
fff6dffd88
|
@ -166,8 +166,10 @@ declare var UIkit: any;
|
|||
|
||||
<modal-alert #workModal large="true">
|
||||
<div *ngIf="orcidWorks">
|
||||
<div *ngFor="let work of orcidWorks['bulk']">
|
||||
<ng-container *ngTemplateOutlet="orcidWorkPreview; context:{work: work['work']}"></ng-container>
|
||||
<div *ngFor="let work of orcidWorks">
|
||||
<ng-container *ngIf="work.work">
|
||||
<ng-container *ngTemplateOutlet="orcidWorkPreview; context:{work: work['work']}"></ng-container>
|
||||
</ng-container>
|
||||
</div>
|
||||
</div>
|
||||
</modal-alert>
|
||||
|
@ -596,11 +598,19 @@ export class OrcidWorkComponent {
|
|||
} else {
|
||||
this.showLoading = true;
|
||||
this.subscriptions.push(this.orcidService.getOrcidWorks(this.putCodes).subscribe(
|
||||
(response: WorkV3_0[]) => {
|
||||
if(response) {
|
||||
this.orcidWorks = response;
|
||||
this.openWorkModal();
|
||||
} else {
|
||||
(response) => {
|
||||
let error: boolean = true;
|
||||
if(response && response['bulk']) {
|
||||
response = response['bulk'].filter(res => {
|
||||
return (!res.error && res.work);
|
||||
});
|
||||
if(response && response.length > 0) {
|
||||
error = false;
|
||||
this.orcidWorks = response;
|
||||
this.openWorkModal();
|
||||
}
|
||||
}
|
||||
if(error) {
|
||||
UIkit.notification({
|
||||
message: 'There was an error getting this work. </br> Please make sure you have not deleted it from your ORCID iD.',
|
||||
status: 'warning',
|
||||
|
|
|
@ -114,7 +114,7 @@ export class OrcidService {
|
|||
|
||||
getOrcidWorks(putCodes: string[]) {
|
||||
let url: string = properties.orcidAPIURL + "orcid/works?put_codes="+putCodes.join(",");
|
||||
return this.http.get<any[]>(url, CustomOptions.registryOptions());
|
||||
return this.http.get<any>(url, CustomOptions.registryOptions());
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue