@@ -7,7 +7,7 @@ import { SocialAuthService, SocialUser } from 'angularx-social-login';
77import { environment } from 'src/environments/environment' ;
88import { EnvironmentType } from 'src/environments/enum' ;
99import { LoginService } from './services/login.service' ;
10- import { map } from 'rxjs/operators' ;
10+ import { tap } from 'rxjs/operators' ;
1111@Component ( {
1212 selector : 'app-login' ,
1313 templateUrl : './login.component.html' ,
@@ -42,30 +42,26 @@ export class LoginComponent implements OnInit {
4242 }
4343
4444 login ( ) {
45- return this . azureAdB2CService . isLogin ( ) . pipe (
46- map ( isLogin => {
47- if ( isLogin ) {
45+ this . azureAdB2CService . isLogin ( ) . subscribe ( isLogin => {
46+ if ( isLogin ) {
47+ this . router . navigate ( [ '' ] ) ;
48+ } else {
49+ this . azureAdB2CService . signIn ( ) . subscribe ( ( ) => {
50+ this . featureToggleCookiesService . setCookies ( ) ;
51+ this . azureAdB2CService . setCookies ( ) ;
4852 this . router . navigate ( [ '' ] ) ;
49- } else {
50- this . azureAdB2CService . signIn ( ) . subscribe ( ( ) => {
51- this . featureToggleCookiesService . setCookies ( ) ;
52- this . azureAdB2CService . setCookies ( ) ;
53- this . router . navigate ( [ '' ] ) ;
54- } ) ;
55- }
56- } )
57- ) ;
53+ } ) ;
54+ }
55+ } ) ;
5856 }
5957
6058 loginWithGoogle ( ) {
61- return this . loginService . isLogin ( ) . pipe (
62- map ( isLogin => {
63- if ( isLogin ) {
64- this . router . navigate ( [ '' ] ) ;
65- } else {
66- this . loginService . signIn ( ) ;
67- }
68- } )
69- ) ;
59+ this . loginService . isLogin ( ) . subscribe ( isLogin => {
60+ if ( isLogin ) {
61+ this . router . navigate ( [ '' ] ) ;
62+ } else {
63+ this . loginService . signIn ( ) ;
64+ }
65+ } ) ;
7066 }
7167}
0 commit comments