diff --git a/frontend/src/app/components/medical-sources-connected/medical-sources-connected.component.ts b/frontend/src/app/components/medical-sources-connected/medical-sources-connected.component.ts index e7dfc16e..4c2cfe82 100644 --- a/frontend/src/app/components/medical-sources-connected/medical-sources-connected.component.ts +++ b/frontend/src/app/components/medical-sources-connected/medical-sources-connected.component.ts @@ -190,7 +190,9 @@ export class MedicalSourcesConnectedComponent implements OnInit { // this.connectedSourceList. //find the index of the "inprogress" source in the connected List, and then add this source to its source metadata. - let foundSource = this.connectedSourceList.findIndex((item) => item.brand.id == dbSourceCredential.brand_id) + let foundSource = this.connectedSourceList.findIndex((item) => { + return item.source?.brand_id == dbSourceCredential.brand_id || item.brand?.id == dbSourceCredential.brand_id + }) this.connectedSourceList[foundSource].source = resp.source console.log("source sync-all response:", resp.summary) @@ -402,6 +404,7 @@ export class MedicalSourcesConnectedComponent implements OnInit { if(!desktopRedirectData){ return //wait for redirect } + //Note: this code will only run in Desktop mode (with popups) //in non-desktop environments, the user is redirected in the same window, and this code is never executed. diff --git a/frontend/src/app/pages/medical-sources/medical-sources.component.ts b/frontend/src/app/pages/medical-sources/medical-sources.component.ts index a9183d0a..d6215e0e 100644 --- a/frontend/src/app/pages/medical-sources/medical-sources.component.ts +++ b/frontend/src/app/pages/medical-sources/medical-sources.component.ts @@ -292,7 +292,11 @@ export class MedicalSourcesComponent implements OnInit { console.log('authorize url:', authorizationUrl.toString()); // redirect to lighthouse with uri's (or open a new window in desktop mode) - this.lighthouseApi.redirectWithOriginAndDestination(authorizationUrl.toString(), sourceMetadata).subscribe((codeData) => { + this.lighthouseApi.redirectWithOriginAndDestination(authorizationUrl.toString(), sourceMetadata).subscribe((desktopRedirectData) => { + if(!desktopRedirectData){ + return //wait for redirect + } + //Note: this code will only run in Desktop mode (with popups) //in non-desktop environments, the user is redirected in the same window, and this code is never executed. @@ -300,7 +304,7 @@ export class MedicalSourcesComponent implements OnInit { this.modalService.dismissAll() //redirect the browser back to this page with the code in the query string parameters - this.lighthouseApi.redirectWithDesktopCode(sourceMetadata.platform_type, codeData) + this.lighthouseApi.redirectWithDesktopCode(desktopRedirectData.state, desktopRedirectData.codeData) }) }); }