Skip to content

Commit 7d9651b

Browse files
author
anishfyle
committed
pr comment
1 parent 8d18307 commit 7d9651b

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/app/auth/login/login.component.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { StorageService } from 'src/app/core/services/common/storage.service';
1616
import { NetsuiteAuthService } from 'src/app/core/services/netsuite/netsuite-core/netsuite-auth.service';
1717
import { XeroAuthService } from 'src/app/core/services/xero/xero-core/xero-auth.service';
1818
import { exposeAppConfig } from 'src/app/branding/expose-app-config';
19+
import { brandingConfig } from 'src/app/branding/branding-config';
1920

2021
@Component({
2122
selector: 'app-login',
@@ -24,7 +25,11 @@ import { exposeAppConfig } from 'src/app/branding/expose-app-config';
2425
})
2526
export class LoginComponent implements OnInit {
2627

27-
readonly exposeApps = exposeAppConfig;
28+
readonly brandingConfig = brandingConfig;
29+
30+
readonly isINCluster = this.storageService.get('cluster-domain').includes('in1');
31+
32+
readonly exposeApps = !this.isINCluster ? exposeAppConfig[brandingConfig.brandId][brandingConfig.envId] : exposeAppConfig[brandingConfig.brandId]['production-1-in'];
2833

2934
constructor(
3035
private authService: AuthService,
@@ -67,37 +72,37 @@ export class LoginComponent implements OnInit {
6772
};
6873
this.userService.storeUserProfile(user);
6974

70-
if (this.exposeApps.fyle.QBD && this.exposeApps.co.QBD) {
75+
if (this.exposeApps.QBD) {
7176
this.helperService.setBaseApiURL(AppUrl.QBD);
7277
this.qbdAuthService.qbdLogin(clusterDomainWithToken.tokens.refresh_token).subscribe();
7378
}
7479

75-
if (this.exposeApps.fyle.SAGE300 && this.exposeApps.co.SAGE300) {
80+
if (this.exposeApps.SAGE300) {
7681
this.helperService.setBaseApiURL(AppUrl.SAGE300);
7782
this.sage300AuthService.loginWithRefreshToken(clusterDomainWithToken.tokens.refresh_token).subscribe();
7883
}
7984

80-
if (this.exposeApps.fyle.BUSINESS_CENTRAL && this.exposeApps.co.BUSINESS_CENTRAL) {
85+
if (this.exposeApps.BUSINESS_CENTRAL) {
8186
this.helperService.setBaseApiURL(AppUrl.BUSINESS_CENTRAL);
8287
this.businessCentralAuthService.loginWithRefreshToken(clusterDomainWithToken.tokens.refresh_token).subscribe();
8388
}
8489

8590
// Only local dev needs this, login happens via postMessage for prod/staging through webapp
8691
if (!environment.production) {
8792
this.userService.storeUserProfile(user);
88-
if (this.exposeApps.fyle.QBO && this.exposeApps.co.QBO) {
93+
if (this.exposeApps.QBO) {
8994
this.helperService.setBaseApiURL(AppUrl.QBO);
9095
this.qboAuthService.loginWithRefreshToken(clusterDomainWithToken.tokens.refresh_token).subscribe();
9196
}
92-
if (this.exposeApps.fyle.INTACCT && this.exposeApps.co.INTACCT) {
97+
if (this.exposeApps.INTACCT) {
9398
this.helperService.setBaseApiURL(AppUrl.INTACCT);
9499
this.siAuthService.loginWithRefreshToken(clusterDomainWithToken.tokens.refresh_token).subscribe();
95100
}
96-
if (this.exposeApps.fyle.NETSUITE && this.exposeApps.co.NETSUITE) {
101+
if (this.exposeApps.NETSUITE) {
97102
this.helperService.setBaseApiURL(AppUrl.NETSUITE);
98103
this.netsuiteAuthService.loginWithRefreshToken(clusterDomainWithToken.tokens.refresh_token).subscribe();
99104
}
100-
if (this.exposeApps.fyle.XERO && this.exposeApps.co.XERO) {
105+
if (this.exposeApps.XERO) {
101106
this.helperService.setBaseApiURL(AppUrl.XERO);
102107
this.xeroAuthService.loginWithRefreshToken(clusterDomainWithToken.tokens.refresh_token).subscribe();
103108
}

0 commit comments

Comments
 (0)