Skip to content

Commit 3f691c4

Browse files
author
Rodrigo Lins
committed
fix TTA-83: Returning to login functions to subscribe
1 parent c695593 commit 3f691c4

File tree

2 files changed

+19
-22
lines changed

2 files changed

+19
-22
lines changed

src/app/modules/login/login.component.ts

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { SocialAuthService, SocialUser } from 'angularx-social-login';
77
import { environment } from 'src/environments/environment';
88
import { EnvironmentType } from 'src/environments/enum';
99
import { 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
}

src/app/modules/user/services/user-info.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Injectable } from '@angular/core';
22
import { JwtHelperService } from '@auth0/angular-jwt';
3+
import { Observable, of } from 'rxjs';
34
import { GROUPS } from '../../../../environments/environment';
45

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

0 commit comments

Comments
 (0)