Skip to content

Commit 5e432fa

Browse files
author
Abigail Cabascango
committed
fix: TTA-208 manage bad request and fix linters
1 parent 22c6be7 commit 5e432fa

File tree

6 files changed

+14
-11
lines changed

6 files changed

+14
-11
lines changed

src/app/app-routing.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,6 @@ if (isNotLegacy) {
5151
imports: [RouterModule.forRoot(routes)],
5252
exports: [RouterModule],
5353
})
54-
export class AppRoutingModule {
54+
export class AppRoutingModule {
5555

5656
}

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
}

src/app/modules/login/services/login.service.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ describe('LoginService', () => {
130130
expect(localStorage.clear).toHaveBeenCalled();
131131
expect(cookieService.deleteAll).toHaveBeenCalled();
132132
});
133-
133+
134134
it('should return an http observable when call invalidateSessionCooke', () => {
135135
const result = service.invalidateSessionCookie();
136136
expect(result).toBeDefined();

src/app/modules/login/services/login.service.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ export class LoginService {
4848
return user && this.cookieService.check('idtoken') ? of(true) : of(false);
4949
} else {
5050
return token ? of(true) : of(false);
51-
//return this.isValidToken(token);
5251
}
5352
}
5453

src/app/modules/shared/pipes/substract-date-return-float/substract-date-return-float.pipe.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ describe('SubstractDatePipeDisplayAsFloat', () => {
66
expect(pipe).toBeTruthy();
77
});
88

9-
/*TODO: tests will be more robust if they take into account FIXED_POINT_DIGITS*/
9+
/*TODO: tests will be more robust if they take into account FIXED_POINT_DIGITS*/
1010
it('returns the date diff as float hours (xx.xx)', () => {
1111
[
1212
{ endDate: '2021-04-11T10:20:00Z', startDate: '2021-04-11T08:00:00Z', expectedDiff: '2.33' },

src/polyfills.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@ import 'zone.js/dist/zone'; // Included with Angular CLI.
6262
* APPLICATION IMPORTS
6363
*/
6464

65-
(window as any).process = {
65+
(window as any).process = {
6666
env: { DEBUG: undefined },
6767
};

0 commit comments

Comments
 (0)