From 7d9651b77c673fec5ebb6ea763a081fb0f824fea Mon Sep 17 00:00:00 2001 From: anishfyle Date: Wed, 22 May 2024 16:00:53 +0530 Subject: [PATCH] pr comment --- src/app/auth/login/login.component.ts | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/app/auth/login/login.component.ts b/src/app/auth/login/login.component.ts index 18145d31b..7c20ed65b 100644 --- a/src/app/auth/login/login.component.ts +++ b/src/app/auth/login/login.component.ts @@ -16,6 +16,7 @@ import { StorageService } from 'src/app/core/services/common/storage.service'; import { NetsuiteAuthService } from 'src/app/core/services/netsuite/netsuite-core/netsuite-auth.service'; import { XeroAuthService } from 'src/app/core/services/xero/xero-core/xero-auth.service'; import { exposeAppConfig } from 'src/app/branding/expose-app-config'; +import { brandingConfig } from 'src/app/branding/branding-config'; @Component({ selector: 'app-login', @@ -24,7 +25,11 @@ import { exposeAppConfig } from 'src/app/branding/expose-app-config'; }) export class LoginComponent implements OnInit { - readonly exposeApps = exposeAppConfig; + readonly brandingConfig = brandingConfig; + + readonly isINCluster = this.storageService.get('cluster-domain').includes('in1'); + + readonly exposeApps = !this.isINCluster ? exposeAppConfig[brandingConfig.brandId][brandingConfig.envId] : exposeAppConfig[brandingConfig.brandId]['production-1-in']; constructor( private authService: AuthService, @@ -67,17 +72,17 @@ export class LoginComponent implements OnInit { }; this.userService.storeUserProfile(user); - if (this.exposeApps.fyle.QBD && this.exposeApps.co.QBD) { + if (this.exposeApps.QBD) { this.helperService.setBaseApiURL(AppUrl.QBD); this.qbdAuthService.qbdLogin(clusterDomainWithToken.tokens.refresh_token).subscribe(); } - if (this.exposeApps.fyle.SAGE300 && this.exposeApps.co.SAGE300) { + if (this.exposeApps.SAGE300) { this.helperService.setBaseApiURL(AppUrl.SAGE300); this.sage300AuthService.loginWithRefreshToken(clusterDomainWithToken.tokens.refresh_token).subscribe(); } - if (this.exposeApps.fyle.BUSINESS_CENTRAL && this.exposeApps.co.BUSINESS_CENTRAL) { + if (this.exposeApps.BUSINESS_CENTRAL) { this.helperService.setBaseApiURL(AppUrl.BUSINESS_CENTRAL); this.businessCentralAuthService.loginWithRefreshToken(clusterDomainWithToken.tokens.refresh_token).subscribe(); } @@ -85,19 +90,19 @@ export class LoginComponent implements OnInit { // Only local dev needs this, login happens via postMessage for prod/staging through webapp if (!environment.production) { this.userService.storeUserProfile(user); - if (this.exposeApps.fyle.QBO && this.exposeApps.co.QBO) { + if (this.exposeApps.QBO) { this.helperService.setBaseApiURL(AppUrl.QBO); this.qboAuthService.loginWithRefreshToken(clusterDomainWithToken.tokens.refresh_token).subscribe(); } - if (this.exposeApps.fyle.INTACCT && this.exposeApps.co.INTACCT) { + if (this.exposeApps.INTACCT) { this.helperService.setBaseApiURL(AppUrl.INTACCT); this.siAuthService.loginWithRefreshToken(clusterDomainWithToken.tokens.refresh_token).subscribe(); } - if (this.exposeApps.fyle.NETSUITE && this.exposeApps.co.NETSUITE) { + if (this.exposeApps.NETSUITE) { this.helperService.setBaseApiURL(AppUrl.NETSUITE); this.netsuiteAuthService.loginWithRefreshToken(clusterDomainWithToken.tokens.refresh_token).subscribe(); } - if (this.exposeApps.fyle.XERO && this.exposeApps.co.XERO) { + if (this.exposeApps.XERO) { this.helperService.setBaseApiURL(AppUrl.XERO); this.xeroAuthService.loginWithRefreshToken(clusterDomainWithToken.tokens.refresh_token).subscribe(); }