Skip to content
Prev Previous commit
Next Next commit
fix TTA-83: Returning to login functions to subscribe
  • Loading branch information
Rodrigo Lins committed Jul 27, 2022
commit 3f691c4b619ea99dc3106e5e1d7d696b448928bc
40 changes: 18 additions & 22 deletions src/app/modules/login/login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { SocialAuthService, SocialUser } from 'angularx-social-login';
import { environment } from 'src/environments/environment';
import { EnvironmentType } from 'src/environments/enum';
import { LoginService } from './services/login.service';
import { map } from 'rxjs/operators';
import { tap } from 'rxjs/operators';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
Expand Down Expand Up @@ -42,30 +42,26 @@ export class LoginComponent implements OnInit {
}

login() {
return this.azureAdB2CService.isLogin().pipe(
map(isLogin => {
if (isLogin) {
this.azureAdB2CService.isLogin().subscribe(isLogin => {
if (isLogin) {
this.router.navigate(['']);
} else {
this.azureAdB2CService.signIn().subscribe(() => {
this.featureToggleCookiesService.setCookies();
this.azureAdB2CService.setCookies();
this.router.navigate(['']);
} else {
this.azureAdB2CService.signIn().subscribe(() => {
this.featureToggleCookiesService.setCookies();
this.azureAdB2CService.setCookies();
this.router.navigate(['']);
});
}
})
);
});
}
});
}

loginWithGoogle() {
return this.loginService.isLogin().pipe(
map(isLogin => {
if (isLogin) {
this.router.navigate(['']);
} else {
this.loginService.signIn();
}
})
);
this.loginService.isLogin().subscribe(isLogin => {
if (isLogin) {
this.router.navigate(['']);
} else {
this.loginService.signIn();
}
});
}
}
1 change: 1 addition & 0 deletions src/app/modules/user/services/user-info.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Injectable } from '@angular/core';
import { JwtHelperService } from '@auth0/angular-jwt';
import { Observable, of } from 'rxjs';
import { GROUPS } from '../../../../environments/environment';

import { LoginService } from '../../login/services/login.service';
Expand Down