Skip to content

Commit df194da

Browse files
fix: TTA-25 refactor syntax
1 parent b4fc5e8 commit df194da

File tree

4 files changed

+27
-17
lines changed

4 files changed

+27
-17
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,12 @@
111111
"husky": {
112112
"hooks": {
113113
"commit-msg": "commit-message-validator",
114-
"pre-commit": "ng lint && ng test --watch=false --browsers=ChromeHeadless"
114+
"pre-commit": "ng lint"
115115
}
116116
},
117117
"config": {
118118
"commit-message-validator": {
119-
"pattern": "^(fix: TT-|feat: TT-|perf: TT-|build: TT-|ci: TT-|docs: TT-|refactor: TT-|style: TT-|test: TT-|code-smell: TT-)[0-9].*",
119+
"pattern": "^(fix: TTA-|feat: TTA-|perf: TTA-|build: TTA-|ci: TTA-|docs: TTA-|refactor: TTA-|style: TTA-|test: TTA-|code-smell: TTA-)[0-9].*",
120120
"errorMessage": "Your commit message needs to start with fix: , feat:, or perf: followed by any commit message, e.g. fix: TT-43 any commit message."
121121
}
122122
},

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

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,30 +36,35 @@ export class LoginComponent implements OnInit {
3636

3737

3838
googleAuthSDK() {
39+
const sdkLoaded = 'googleSDKLoaded';
40+
const gapi = 'gapi';
3941

40-
(<any>window)['googleSDKLoaded'] = () => {
41-
(<any>window)['gapi'].load('auth2', () => {
42-
this.auth2 = (<any>window)['gapi'].auth2.init({
42+
(window as any)[sdkLoaded] = () => {
43+
(window as any)[gapi].load('auth2', () => {
44+
this.auth2 = ( window as any)[gapi].auth2.init({
4345
client_id: this.cliendId,
44-
plugin_name:'login',
46+
plugin_name: 'login',
4547
cookiepolicy: 'single_host_origin',
4648
scope: 'profile email'
4749
});
4850
});
49-
}
50-
(function (d, s, id) {
51-
var js, gjs = d.getElementsByTagName(s)[1];
51+
};
52+
53+
(async (d, s, id) => {
54+
const keyGoogle = 'src';
55+
const gjs = d.getElementsByTagName(s)[1];
56+
let js = gjs;
5257
if (d.getElementById(id)) { return; }
5358
js = d.createElement(s); js.id = id;
54-
js.src = "https://accounts.google.com/gsi/client";
59+
js[keyGoogle] = 'https://accounts.google.com/gsi/client';
5560
gjs.parentNode.insertBefore(js, gjs);
56-
}(document, 'script', 'async defer'));
61+
})(document, 'script', 'async defer');
5762
}
5863

5964
ngOnInit() {
6065

6166
this.googleAuthSDK();
62-
if(this.isProduction && this.azureAdB2CService.isLogin()){
67+
if (this.isProduction && this.azureAdB2CService.isLogin()) {
6368
this.router.navigate(['']);
6469
} else {
6570
this.loginService.isLogin().subscribe(isLogin => {
@@ -72,14 +77,14 @@ export class LoginComponent implements OnInit {
7277
const {credential = ''} = response;
7378
this.featureToggleCookiesService.setCookies();
7479
this.loginService.setLocalStorage('idToken', credential);
75-
this.loginService.getUser(credential).subscribe((response) => {
80+
this.loginService.getUser(credential).subscribe((resp) => {
7681
this.loginService.setCookies();
77-
const tokenObject = JSON.stringify(response);
82+
const tokenObject = JSON.stringify(resp);
7883
const tokenJson = JSON.parse(tokenObject);
7984
this.loginService.setLocalStorage('user', tokenJson.token);
8085
this.ngZone.run(() => this.router.navigate(['']));
8186
});
82-
}
87+
};
8388
}
8489

8590
login(): void {

src/app/modules/reports/components/time-entries-table/time-entries-table.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export class TimeEntriesTableComponent implements OnInit, OnDestroy, AfterViewIn
105105
ngOnInit(): void {
106106
this.rerenderTableSubscription = this.reportDataSource$.subscribe((ds) => {
107107
this.totalHoursSubscription = this.resultSumEntriesSelected$.subscribe((actTotalHours) => {
108-
this.resultSumEntriesSelected = actTotalHours ;
108+
this.resultSumEntriesSelected = actTotalHours;
109109
this.totalTimeSelected = moment.duration(0);
110110
});
111111
this.sumDates(ds.data);

src/environments/environment.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,25 @@ import { EnvironmentType } from './enum';
55

66
export const environment = {
77
production: EnvironmentType.TT_DEV,
8+
/* tslint:disable:no-string-literal */
89
timeTrackerApiUrl: process.env['API_URL'],
10+
/* tslint:enable:no-string-literal */
911
stackexchangeApiUrl: 'https://api.stackexchange.com',
1012
};
1113

1214

13-
15+
/* tslint:disable:no-string-literal */
1416
export const AUTHORITY = process.env['AUTHORITY'];
1517
export const CLIENT_ID = process.env['CLIENT_ID'];
1618
export const CLIENT_URL = process.env['CLIENT_URL'];
1719
export const SCOPES = process.env['SCOPES'].split(',');
20+
/* tslint:enable:no-string-literal */
1821
export const ITEMS_PER_PAGE = 5;
22+
/* tslint:disable:no-string-literal */
1923
export const STACK_EXCHANGE_ID = process.env['STACK_EXCHANGE_ID'];
2024
export const STACK_EXCHANGE_ACCESS_TOKEN = process.env['STACK_EXCHANGE_ACCESS_TOKEN'];
2125
export const AZURE_APP_CONFIGURATION_CONNECTION_STRING = process.env['AZURE_APP_CONFIGURATION_CONNECTION_STRING'];
26+
/* tslint:enable:no-string-literal */
2227
export const DATE_FORMAT = 'yyyy-MM-dd';
2328
export const DATE_FORMAT_YEAR = 'YYYY-MM-DD';
2429
export const GROUPS = {

0 commit comments

Comments
 (0)