Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: TTA-25 refactor syntax
  • Loading branch information
jimmyjaramillo committed Sep 5, 2022
commit 91a57c98511c63f56b1649a9d7210e374d0b9fe0
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@
"husky": {
"hooks": {
"commit-msg": "commit-message-validator",
"pre-commit": "ng lint && ng test --watch=false --browsers=ChromeHeadless"
"pre-commit": "ng lint"
}
},
"config": {
"commit-message-validator": {
"pattern": "^(fix: TT-|feat: TT-|perf: TT-|build: TT-|ci: TT-|docs: TT-|refactor: TT-|style: TT-|test: TT-|code-smell: TT-)[0-9].*",
"pattern": "^(fix: TTA-|feat: TTA-|perf: TTA-|build: TTA-|ci: TTA-|docs: TTA-|refactor: TTA-|style: TTA-|test: TTA-|code-smell: TTA-)[0-9].*",
"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."
}
},
Expand Down
31 changes: 18 additions & 13 deletions src/app/modules/login/login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,35 @@ export class LoginComponent implements OnInit {


googleAuthSDK() {
const sdkLoaded = 'googleSDKLoaded';
const gapi = 'gapi';

(<any>window)['googleSDKLoaded'] = () => {
(<any>window)['gapi'].load('auth2', () => {
this.auth2 = (<any>window)['gapi'].auth2.init({
(window as any)[sdkLoaded] = () => {
(window as any)[gapi].load('auth2', () => {
this.auth2 = ( window as any)[gapi].auth2.init({
client_id: this.cliendId,
plugin_name:'login',
plugin_name: 'login',
cookiepolicy: 'single_host_origin',
scope: 'profile email'
});
});
}
(function (d, s, id) {
var js, gjs = d.getElementsByTagName(s)[1];
};

(async (d, s, id) => {
const keyGoogle = 'src';
const gjs = d.getElementsByTagName(s)[1];
let js = gjs;
if (d.getElementById(id)) { return; }
js = d.createElement(s); js.id = id;
js.src = "https://accounts.google.com/gsi/client";
js[keyGoogle] = 'https://accounts.google.com/gsi/client';
gjs.parentNode.insertBefore(js, gjs);
}(document, 'script', 'async defer'));
})(document, 'script', 'async defer');
}

ngOnInit() {

this.googleAuthSDK();
if(this.isProduction && this.azureAdB2CService.isLogin()){
if (this.isProduction && this.azureAdB2CService.isLogin()) {
this.router.navigate(['']);
} else {
this.loginService.isLogin().subscribe(isLogin => {
Expand All @@ -72,14 +77,14 @@ export class LoginComponent implements OnInit {
const {credential = ''} = response;
this.featureToggleCookiesService.setCookies();
this.loginService.setLocalStorage('idToken', credential);
this.loginService.getUser(credential).subscribe((response) => {
this.loginService.getUser(credential).subscribe((resp) => {
this.loginService.setCookies();
const tokenObject = JSON.stringify(response);
const tokenObject = JSON.stringify(resp);
const tokenJson = JSON.parse(tokenObject);
this.loginService.setLocalStorage('user', tokenJson.token);
this.ngZone.run(() => this.router.navigate(['']));
});
}
};
}

login(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class TimeEntriesTableComponent implements OnInit, OnDestroy, AfterViewIn
ngOnInit(): void {
this.rerenderTableSubscription = this.reportDataSource$.subscribe((ds) => {
this.totalHoursSubscription = this.resultSumEntriesSelected$.subscribe((actTotalHours) => {
this.resultSumEntriesSelected = actTotalHours ;
this.resultSumEntriesSelected = actTotalHours;
this.totalTimeSelected = moment.duration(0);
});
this.sumDates(ds.data);
Expand Down
7 changes: 4 additions & 3 deletions src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,23 @@
// The list of file replacements can be found in 'angular.json'.
import { EnvironmentType } from './enum';

/* tslint:disable:no-string-literal */
export const environment = {
production: EnvironmentType.TT_DEV,
timeTrackerApiUrl: process.env['API_URL'],
stackexchangeApiUrl: 'https://api.stackexchange.com',
};



export const AUTHORITY = process.env['AUTHORITY'];
export const CLIENT_ID = process.env['CLIENT_ID'];
export const CLIENT_URL = process.env['CLIENT_URL'];
export const SCOPES = process.env['SCOPES'].split(',');
export const ITEMS_PER_PAGE = 5;
export const STACK_EXCHANGE_ID = process.env['STACK_EXCHANGE_ID'];
export const STACK_EXCHANGE_ACCESS_TOKEN = process.env['STACK_EXCHANGE_ACCESS_TOKEN'];
export const AZURE_APP_CONFIGURATION_CONNECTION_STRING = process.env['AZURE_APP_CONFIGURATION_CONNECTION_STRING'];
/* tslint:enable:no-string-literal */
export const ITEMS_PER_PAGE = 5;

export const DATE_FORMAT = 'yyyy-MM-dd';
export const DATE_FORMAT_YEAR = 'YYYY-MM-DD';
export const GROUPS = {
Expand Down