From e565b8d5302e3ab0c5ab4b264a0f686756211552 Mon Sep 17 00:00:00 2001 From: Liz Krznarich Date: Tue, 25 Apr 2017 16:51:22 -0500 Subject: [PATCH 1/3] get orcid url from config service --- server.js | 2 +- .../add-id-success.component.html | 2 +- .../add-id-success/add-id-success.component.ts | 17 ++++++++++++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/server.js b/server.js index 3aac186..2ad713b 100644 --- a/server.js +++ b/server.js @@ -263,7 +263,7 @@ app.get(ADD_ID_REDIRECT, function(req, res) { // Redeem code URL if (err) res.send(err) else { //res.redirect('/' + req.query.state); - res.redirect( /* make ADD_ID_SUCCESS url */ '/' + state + '/orcid/' + encodeURIComponent(config.ORCID_URL) + '%2F' + token.orcid); + res.redirect( /* make ADD_ID_SUCCESS url */ '/' + state + '/orcid/' + token.orcid); } }); } diff --git a/src/app/add-id-success/add-id-success.component.html b/src/app/add-id-success/add-id-success.component.html index e55db79..64b1ca1 100644 --- a/src/app/add-id-success/add-id-success.component.html +++ b/src/app/add-id-success/add-id-success.component.html @@ -7,7 +7,7 @@

Thanks!

We've added your ORCID iD -
ORCID iD icon{{userOrcidId}} +
ORCID iD icon{{orcidUrl}}/{{userOrcidId}}
to {{collections.form.title}}

Close diff --git a/src/app/add-id-success/add-id-success.component.ts b/src/app/add-id-success/add-id-success.component.ts index 070480c..1df8626 100644 --- a/src/app/add-id-success/add-id-success.component.ts +++ b/src/app/add-id-success/add-id-success.component.ts @@ -7,6 +7,7 @@ import 'rxjs/add/operator/switchMap'; import { Collection } from './../shared/collection/collection'; import { CollectionService } from './../shared/collection/collection.service'; +import { ConfigService } from './../shared/config/config.service'; @Component({ selector: 'app-add-id-success', @@ -18,13 +19,16 @@ export class AddIdSuccessComponent implements OnInit, OnDestroy { public publicKey: string; private response: any; private sub: any; + public orcidUrl: string; public userOrcidId: string; + public config: string; collections: Collection[]; constructor( private route: ActivatedRoute, - private collectionService: CollectionService + private collectionService: CollectionService, + private configService: ConfigService ) { } @@ -36,11 +40,22 @@ export class AddIdSuccessComponent implements OnInit, OnDestroy { ); } + getConfig(): void { + this.configService.getConfiguration().subscribe( + response => { + this.response = response; + this.orcidUrl = this.response.ORCID_URL; + } + ); + } + ngOnInit() { this.sub = this.route.params.subscribe(params => { this.publicKey = params['publicKey']; this.userOrcidId = params['orcid']; this.getCollections(); + this.getConfig(); + }); } From 93ba04fbee447f64fa2d6aa44705512fbb744344 Mon Sep 17 00:00:00 2001 From: Liz Krznarich Date: Tue, 25 Apr 2017 16:53:34 -0500 Subject: [PATCH 2/3] fix spacing and remove unused var --- src/app/add-id-success/add-id-success.component.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/app/add-id-success/add-id-success.component.ts b/src/app/add-id-success/add-id-success.component.ts index 1df8626..9139983 100644 --- a/src/app/add-id-success/add-id-success.component.ts +++ b/src/app/add-id-success/add-id-success.component.ts @@ -21,7 +21,6 @@ export class AddIdSuccessComponent implements OnInit, OnDestroy { private sub: any; public orcidUrl: string; public userOrcidId: string; - public config: string; collections: Collection[]; @@ -43,9 +42,9 @@ export class AddIdSuccessComponent implements OnInit, OnDestroy { getConfig(): void { this.configService.getConfiguration().subscribe( response => { - this.response = response; - this.orcidUrl = this.response.ORCID_URL; - } + this.response = response; + this.orcidUrl = this.response.ORCID_URL; + } ); } @@ -54,8 +53,7 @@ export class AddIdSuccessComponent implements OnInit, OnDestroy { this.publicKey = params['publicKey']; this.userOrcidId = params['orcid']; this.getCollections(); - this.getConfig(); - + this.getConfig(); }); } From 515bea675ce0ee50be73ed286512c266e1886092 Mon Sep 17 00:00:00 2001 From: rcpeters Date: Tue, 25 Apr 2017 15:44:09 -0700 Subject: [PATCH 3/3] update to be simpler and asynchronous --- .../add-id-success/add-id-success.component.ts | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/app/add-id-success/add-id-success.component.ts b/src/app/add-id-success/add-id-success.component.ts index 9139983..2fa5620 100644 --- a/src/app/add-id-success/add-id-success.component.ts +++ b/src/app/add-id-success/add-id-success.component.ts @@ -17,7 +17,6 @@ import { ConfigService } from './../shared/config/config.service'; export class AddIdSuccessComponent implements OnInit, OnDestroy { public publicKey: string; - private response: any; private sub: any; public orcidUrl: string; public userOrcidId: string; @@ -29,6 +28,10 @@ export class AddIdSuccessComponent implements OnInit, OnDestroy { private collectionService: CollectionService, private configService: ConfigService ) { + this.configService.getConfiguration().subscribe( + config => { + this.orcidUrl = config['ORCID_URL']; + }); } getCollections(): void { @@ -39,21 +42,11 @@ export class AddIdSuccessComponent implements OnInit, OnDestroy { ); } - getConfig(): void { - this.configService.getConfiguration().subscribe( - response => { - this.response = response; - this.orcidUrl = this.response.ORCID_URL; - } - ); - } - ngOnInit() { this.sub = this.route.params.subscribe(params => { this.publicKey = params['publicKey']; this.userOrcidId = params['orcid']; this.getCollections(); - this.getConfig(); }); }