[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">
|
<modal-alert #workModal large="true">
|
||||||
<div *ngIf="orcidWorks">
|
<div *ngIf="orcidWorks">
|
||||||
<div *ngFor="let work of orcidWorks['bulk']">
|
<div *ngFor="let work of orcidWorks">
|
||||||
<ng-container *ngTemplateOutlet="orcidWorkPreview; context:{work: work['work']}"></ng-container>
|
<ng-container *ngIf="work.work">
|
||||||
|
<ng-container *ngTemplateOutlet="orcidWorkPreview; context:{work: work['work']}"></ng-container>
|
||||||
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</modal-alert>
|
</modal-alert>
|
||||||
|
@ -596,11 +598,19 @@ export class OrcidWorkComponent {
|
||||||
} else {
|
} else {
|
||||||
this.showLoading = true;
|
this.showLoading = true;
|
||||||
this.subscriptions.push(this.orcidService.getOrcidWorks(this.putCodes).subscribe(
|
this.subscriptions.push(this.orcidService.getOrcidWorks(this.putCodes).subscribe(
|
||||||
(response: WorkV3_0[]) => {
|
(response) => {
|
||||||
if(response) {
|
let error: boolean = true;
|
||||||
this.orcidWorks = response;
|
if(response && response['bulk']) {
|
||||||
this.openWorkModal();
|
response = response['bulk'].filter(res => {
|
||||||
} else {
|
return (!res.error && res.work);
|
||||||
|
});
|
||||||
|
if(response && response.length > 0) {
|
||||||
|
error = false;
|
||||||
|
this.orcidWorks = response;
|
||||||
|
this.openWorkModal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(error) {
|
||||||
UIkit.notification({
|
UIkit.notification({
|
||||||
message: 'There was an error getting this work. </br> Please make sure you have not deleted it from your ORCID iD.',
|
message: 'There was an error getting this work. </br> Please make sure you have not deleted it from your ORCID iD.',
|
||||||
status: 'warning',
|
status: 'warning',
|
||||||
|
|
|
@ -114,7 +114,7 @@ export class OrcidService {
|
||||||
|
|
||||||
getOrcidWorks(putCodes: string[]) {
|
getOrcidWorks(putCodes: string[]) {
|
||||||
let url: string = properties.orcidAPIURL + "orcid/works?put_codes="+putCodes.join(",");
|
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