From 38fa69e2c9c53ae12254d7dc66ea63dbaec0d334 Mon Sep 17 00:00:00 2001 From: Mathieu Sanchez Date: Wed, 22 May 2019 14:16:04 +0900 Subject: [PATCH] Reformat code + Correction merging app.module.ts --- src/app/app-routing.module.ts | 4 ++-- src/app/app.component.ts | 6 ++--- src/app/app.module.ts | 10 ++++---- src/app/core/services/auth/auth.service.ts | 26 ++++++++++----------- src/app/core/services/seo/seo.service.ts | 3 ++- src/app/header/header.component.spec.ts | 26 ++++++++++----------- src/app/header/header.component.ts | 4 ++-- src/app/home/home.component.spec.ts | 26 ++++++++++----------- src/app/home/home.component.ts | 9 +++---- src/app/register/register.component.spec.ts | 26 ++++++++++----------- src/app/register/register.component.ts | 9 +++---- 11 files changed, 74 insertions(+), 75 deletions(-) diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 9208b22..0c989e6 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,12 +1,12 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { HomeComponent } from './home/home.component'; -import { RegisterComponent} from './register/register.component'; +import { RegisterComponent } from './register/register.component'; const routes: Routes = [ // No logged pages { path: '', component: HomeComponent, }, - { path: 'register', component: RegisterComponent}, + { path: 'register', component: RegisterComponent }, // { // path: 'login', // component: LoginComponent, diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 47816ce..e7e0103 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,11 +1,11 @@ import { Component, OnInit } from '@angular/core'; import { SEOService } from '@app/core/services'; -@Component({ +@Component( { selector: 'app-root', templateUrl: './app.component.html', - styleUrls: ['./app.component.css'] -}) + styleUrls: [ './app.component.css' ] +} ) export class AppComponent implements OnInit { title = 'DiscoTrip'; diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 79220ac..eac0dc4 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -3,6 +3,7 @@ import { ErrorHandler, NgModule } from '@angular/core'; import { AppComponent } from './app.component'; import { HomeComponent } from './home/home.component'; import { HeaderComponent } from './header/header.component'; +import { RegisterComponent } from './register/register.component'; import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; @@ -10,16 +11,13 @@ import { AppRoutingModule } from '@app/app-routing.module'; import { AngularFireModule } from '@angular/fire'; import { AngularFireDatabaseModule } from '@angular/fire/database'; import { AppMaterialModule } from '@app/app-material.module'; -import { AppRoutingModule } from '@app/app-routing.module'; -import { HeaderComponent } from './header/header.component'; -import { RegisterComponent } from './register/register.component'; import { LogService, SEOService } from '@app/core/services'; import { GlobalErrorHandler } from '@app/core/global-error-handler/global-error-handler.service'; import { environment } from '@env/environment'; -@NgModule({ +@NgModule( { declarations: [ AppComponent, HomeComponent, @@ -30,7 +28,7 @@ import { environment } from '@env/environment'; BrowserModule, BrowserAnimationsModule, AppRoutingModule, - AngularFireModule.initializeApp(environment.firebaseConfig), + AngularFireModule.initializeApp( environment.firebaseConfig ), AngularFireDatabaseModule, AppMaterialModule, ], @@ -43,6 +41,6 @@ import { environment } from '@env/environment'; }, ], bootstrap: [ AppComponent ] -}) +} ) export class AppModule { } diff --git a/src/app/core/services/auth/auth.service.ts b/src/app/core/services/auth/auth.service.ts index 8af36c3..6fdfef0 100644 --- a/src/app/core/services/auth/auth.service.ts +++ b/src/app/core/services/auth/auth.service.ts @@ -2,14 +2,12 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { BehaviorSubject, Observable } from 'rxjs'; import { Router } from '@angular/router'; -import * as sha512 from 'js-sha512'; - -// import * as config from '@assets/config.json'; - import { User } from '@app/core/model'; import { StorageService } from '@app/core/services/storage/storage.service'; import { LogService } from '@app/core/services/log/log.service'; +// import * as config from '@assets/config.json'; + @Injectable( { providedIn: 'root' } ) export class AuthService { @@ -26,15 +24,15 @@ export class AuthService { // if ( this.currentUserSubject.value && this.currentUserSubject.value.timeGetToken + 60 * 60 * 1000 < new Date().getTime() ) { // const data = new FormData(); - // data.append( 'auth_token', this.currentUserSubject.value.token ); - // this.http.post( environment.baseUrl + config.url.upauth, data ).subscribe( ( res ) => { - // if ( res.statusCode !== 200 ) { - // this.logout(); - // } else { - // this.currentUserSubject.value.timeGetToken = new Date().getTime(); - // this.stor.setLocal( 'user', this.currentUserSubject.value ); - // } - // } ); + // data.append( 'auth_token', this.currentUserSubject.value.token ); + // this.http.post( environment.baseUrl + config.url.upauth, data ).subscribe( ( res ) => { + // if ( res.statusCode !== 200 ) { + // this.logout(); + // } else { + // this.currentUserSubject.value.timeGetToken = new Date().getTime(); + // this.stor.setLocal( 'user', this.currentUserSubject.value ); + // } + // } ); // } return this.currentUserSubject.value; } @@ -81,7 +79,7 @@ export class AuthService { // data.append( 'email', email ); // data.append( 'password', sha512.sha512( password ) ); - // return this.http.post( environment.baseUrl + config.url.register, data ); + // return this.http.post( environment.baseUrl + config.url.register, data ); // } return null; diff --git a/src/app/core/services/seo/seo.service.ts b/src/app/core/services/seo/seo.service.ts index 445cadf..ce8cff9 100644 --- a/src/app/core/services/seo/seo.service.ts +++ b/src/app/core/services/seo/seo.service.ts @@ -12,7 +12,8 @@ export class SEOService { private defaultNoIndex = false; private defaultNoFollow = false; - constructor( private title: Title, private meta: Meta, private router: Router, private activatedRoute: ActivatedRoute ) {} + constructor( private title: Title, private meta: Meta, private router: Router, private activatedRoute: ActivatedRoute ) { + } public start() { this.meta.updateTag( { name: 'og:locale', contest: 'fr_FR' } ); diff --git a/src/app/header/header.component.spec.ts b/src/app/header/header.component.spec.ts index 2d0479d..d18fb0a 100644 --- a/src/app/header/header.component.spec.ts +++ b/src/app/header/header.component.spec.ts @@ -2,24 +2,24 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { HeaderComponent } from './header.component'; -describe('HeaderComponent', () => { +describe( 'HeaderComponent', () => { let component: HeaderComponent; let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ + beforeEach( async( () => { + TestBed.configureTestingModule( { declarations: [ HeaderComponent ] - }) - .compileComponents(); - })); + } ) + .compileComponents(); + } ) ); - beforeEach(() => { - fixture = TestBed.createComponent(HeaderComponent); + beforeEach( () => { + fixture = TestBed.createComponent( HeaderComponent ); component = fixture.componentInstance; fixture.detectChanges(); - }); + } ); - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); + it( 'should create', () => { + expect( component ).toBeTruthy(); + } ); +} ); diff --git a/src/app/header/header.component.ts b/src/app/header/header.component.ts index 6a5e7f3..b1f6c34 100644 --- a/src/app/header/header.component.ts +++ b/src/app/header/header.component.ts @@ -1,10 +1,10 @@ import { Component, OnInit } from '@angular/core'; -@Component({ +@Component( { selector: 'app-header', templateUrl: './header.component.html', styleUrls: [ './header.component.css' ] -}) +} ) export class HeaderComponent implements OnInit { constructor() { diff --git a/src/app/home/home.component.spec.ts b/src/app/home/home.component.spec.ts index 490e81b..d5881ad 100644 --- a/src/app/home/home.component.spec.ts +++ b/src/app/home/home.component.spec.ts @@ -2,24 +2,24 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { HomeComponent } from './home.component'; -describe('HomeComponent', () => { +describe( 'HomeComponent', () => { let component: HomeComponent; let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ + beforeEach( async( () => { + TestBed.configureTestingModule( { declarations: [ HomeComponent ] - }) - .compileComponents(); - })); + } ) + .compileComponents(); + } ) ); - beforeEach(() => { - fixture = TestBed.createComponent(HomeComponent); + beforeEach( () => { + fixture = TestBed.createComponent( HomeComponent ); component = fixture.componentInstance; fixture.detectChanges(); - }); + } ); - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); + it( 'should create', () => { + expect( component ).toBeTruthy(); + } ); +} ); diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts index 33fd770..a714eac 100644 --- a/src/app/home/home.component.ts +++ b/src/app/home/home.component.ts @@ -1,13 +1,14 @@ import { Component, OnInit } from '@angular/core'; -@Component({ +@Component( { selector: 'app-home', templateUrl: './home.component.html', - styleUrls: ['./home.component.css'] -}) + styleUrls: [ './home.component.css' ] +} ) export class HomeComponent implements OnInit { - constructor() { } + constructor() { + } ngOnInit() { } diff --git a/src/app/register/register.component.spec.ts b/src/app/register/register.component.spec.ts index 6c19551..6136685 100644 --- a/src/app/register/register.component.spec.ts +++ b/src/app/register/register.component.spec.ts @@ -2,24 +2,24 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { RegisterComponent } from './register.component'; -describe('RegisterComponent', () => { +describe( 'RegisterComponent', () => { let component: RegisterComponent; let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ + beforeEach( async( () => { + TestBed.configureTestingModule( { declarations: [ RegisterComponent ] - }) - .compileComponents(); - })); + } ) + .compileComponents(); + } ) ); - beforeEach(() => { - fixture = TestBed.createComponent(RegisterComponent); + beforeEach( () => { + fixture = TestBed.createComponent( RegisterComponent ); component = fixture.componentInstance; fixture.detectChanges(); - }); + } ); - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); + it( 'should create', () => { + expect( component ).toBeTruthy(); + } ); +} ); diff --git a/src/app/register/register.component.ts b/src/app/register/register.component.ts index b7db7f8..c3dcde3 100644 --- a/src/app/register/register.component.ts +++ b/src/app/register/register.component.ts @@ -1,13 +1,14 @@ import { Component, OnInit } from '@angular/core'; -@Component({ +@Component( { selector: 'app-register', templateUrl: './register.component.html', - styleUrls: ['./register.component.css'] -}) + styleUrls: [ './register.component.css' ] +} ) export class RegisterComponent implements OnInit { - constructor() { } + constructor() { + } ngOnInit() { }