Skip to content

Commit e432c2c

Browse files
author
Nicole Garcia
committed
style: solve linter problems
2 parents 968909b + 7510181 commit e432c2c

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed
603 Bytes
Binary file not shown.
Binary file not shown.

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,16 @@ export class LoginComponent implements OnInit {
3838

3939
ngOnInit() {
4040
if (!this.isProduction) {
41-
this.loginService.getUser(null).subscribe((resp) => {
42-
this.loginService.setCookies();
43-
const tokenObject = JSON.stringify(resp);
44-
const tokenJson = JSON.parse(tokenObject);
45-
this.loginService.setLocalStorage('user', tokenJson.token);
46-
this.ngZone.run(() => this.router.navigate(['']));
41+
this.loginService.isLogin().subscribe((isLogged) => {
42+
if (isLogged){
43+
this.loginService.getUser(null).subscribe((resp) => {
44+
this.loginService.setCookies();
45+
const tokenObject = JSON.stringify(resp);
46+
const tokenJson = JSON.parse(tokenObject);
47+
this.loginService.setLocalStorage('user', tokenJson.token);
48+
this.ngZone.run(() => this.router.navigate(['']));
49+
});
50+
}
4751
});
4852
}
4953
}

0 commit comments

Comments
 (0)