Reformat code + Correction merging app.module.ts

This commit is contained in:
Mathieu Sanchez 2019-05-22 14:16:04 +09:00
parent f024602072
commit 38fa69e2c9
11 changed files with 74 additions and 75 deletions

View File

@ -1,12 +1,12 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router'; import { RouterModule, Routes } from '@angular/router';
import { HomeComponent } from './home/home.component'; import { HomeComponent } from './home/home.component';
import { RegisterComponent} from './register/register.component'; import { RegisterComponent } from './register/register.component';
const routes: Routes = [ const routes: Routes = [
// No logged pages // No logged pages
{ path: '', component: HomeComponent, }, { path: '', component: HomeComponent, },
{ path: 'register', component: RegisterComponent}, { path: 'register', component: RegisterComponent },
// { // {
// path: 'login', // path: 'login',
// component: LoginComponent, // component: LoginComponent,

View File

@ -1,11 +1,11 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { SEOService } from '@app/core/services'; import { SEOService } from '@app/core/services';
@Component({ @Component( {
selector: 'app-root', selector: 'app-root',
templateUrl: './app.component.html', templateUrl: './app.component.html',
styleUrls: ['./app.component.css'] styleUrls: [ './app.component.css' ]
}) } )
export class AppComponent implements OnInit { export class AppComponent implements OnInit {
title = 'DiscoTrip'; title = 'DiscoTrip';

View File

@ -3,6 +3,7 @@ import { ErrorHandler, NgModule } from '@angular/core';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { HomeComponent } from './home/home.component'; import { HomeComponent } from './home/home.component';
import { HeaderComponent } from './header/header.component'; import { HeaderComponent } from './header/header.component';
import { RegisterComponent } from './register/register.component';
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
@ -10,16 +11,13 @@ import { AppRoutingModule } from '@app/app-routing.module';
import { AngularFireModule } from '@angular/fire'; import { AngularFireModule } from '@angular/fire';
import { AngularFireDatabaseModule } from '@angular/fire/database'; import { AngularFireDatabaseModule } from '@angular/fire/database';
import { AppMaterialModule } from '@app/app-material.module'; 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 { LogService, SEOService } from '@app/core/services';
import { GlobalErrorHandler } from '@app/core/global-error-handler/global-error-handler.service'; import { GlobalErrorHandler } from '@app/core/global-error-handler/global-error-handler.service';
import { environment } from '@env/environment'; import { environment } from '@env/environment';
@NgModule({ @NgModule( {
declarations: [ declarations: [
AppComponent, AppComponent,
HomeComponent, HomeComponent,
@ -30,7 +28,7 @@ import { environment } from '@env/environment';
BrowserModule, BrowserModule,
BrowserAnimationsModule, BrowserAnimationsModule,
AppRoutingModule, AppRoutingModule,
AngularFireModule.initializeApp(environment.firebaseConfig), AngularFireModule.initializeApp( environment.firebaseConfig ),
AngularFireDatabaseModule, AngularFireDatabaseModule,
AppMaterialModule, AppMaterialModule,
], ],
@ -43,6 +41,6 @@ import { environment } from '@env/environment';
}, },
], ],
bootstrap: [ AppComponent ] bootstrap: [ AppComponent ]
}) } )
export class AppModule { export class AppModule {
} }

View File

@ -2,14 +2,12 @@ import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { BehaviorSubject, Observable } from 'rxjs'; import { BehaviorSubject, Observable } from 'rxjs';
import { Router } from '@angular/router'; 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 { User } from '@app/core/model';
import { StorageService } from '@app/core/services/storage/storage.service'; import { StorageService } from '@app/core/services/storage/storage.service';
import { LogService } from '@app/core/services/log/log.service'; import { LogService } from '@app/core/services/log/log.service';
// import * as config from '@assets/config.json';
@Injectable( { providedIn: 'root' } ) @Injectable( { providedIn: 'root' } )
export class AuthService { export class AuthService {
@ -26,15 +24,15 @@ export class AuthService {
// if ( this.currentUserSubject.value && this.currentUserSubject.value.timeGetToken + 60 * 60 * 1000 < new Date().getTime() ) { // if ( this.currentUserSubject.value && this.currentUserSubject.value.timeGetToken + 60 * 60 * 1000 < new Date().getTime() ) {
// const data = new FormData(); // const data = new FormData();
// data.append( 'auth_token', this.currentUserSubject.value.token ); // data.append( 'auth_token', this.currentUserSubject.value.token );
// this.http.post<any>( environment.baseUrl + config.url.upauth, data ).subscribe( ( res ) => { // this.http.post<any>( environment.baseUrl + config.url.upauth, data ).subscribe( ( res ) => {
// if ( res.statusCode !== 200 ) { // if ( res.statusCode !== 200 ) {
// this.logout(); // this.logout();
// } else { // } else {
// this.currentUserSubject.value.timeGetToken = new Date().getTime(); // this.currentUserSubject.value.timeGetToken = new Date().getTime();
// this.stor.setLocal( 'user', this.currentUserSubject.value ); // this.stor.setLocal( 'user', this.currentUserSubject.value );
// } // }
// } ); // } );
// } // }
return this.currentUserSubject.value; return this.currentUserSubject.value;
} }
@ -81,7 +79,7 @@ export class AuthService {
// data.append( 'email', email ); // data.append( 'email', email );
// data.append( 'password', sha512.sha512( password ) ); // 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; return null;

View File

@ -12,7 +12,8 @@ export class SEOService {
private defaultNoIndex = false; private defaultNoIndex = false;
private defaultNoFollow = 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() { public start() {
this.meta.updateTag( { name: 'og:locale', contest: 'fr_FR' } ); this.meta.updateTag( { name: 'og:locale', contest: 'fr_FR' } );

View File

@ -2,24 +2,24 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { HeaderComponent } from './header.component'; import { HeaderComponent } from './header.component';
describe('HeaderComponent', () => { describe( 'HeaderComponent', () => {
let component: HeaderComponent; let component: HeaderComponent;
let fixture: ComponentFixture<HeaderComponent>; let fixture: ComponentFixture<HeaderComponent>;
beforeEach(async(() => { beforeEach( async( () => {
TestBed.configureTestingModule({ TestBed.configureTestingModule( {
declarations: [ HeaderComponent ] declarations: [ HeaderComponent ]
}) } )
.compileComponents(); .compileComponents();
})); } ) );
beforeEach(() => { beforeEach( () => {
fixture = TestBed.createComponent(HeaderComponent); fixture = TestBed.createComponent( HeaderComponent );
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
}); } );
it('should create', () => { it( 'should create', () => {
expect(component).toBeTruthy(); expect( component ).toBeTruthy();
}); } );
}); } );

View File

@ -1,10 +1,10 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
@Component({ @Component( {
selector: 'app-header', selector: 'app-header',
templateUrl: './header.component.html', templateUrl: './header.component.html',
styleUrls: [ './header.component.css' ] styleUrls: [ './header.component.css' ]
}) } )
export class HeaderComponent implements OnInit { export class HeaderComponent implements OnInit {
constructor() { constructor() {

View File

@ -2,24 +2,24 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { HomeComponent } from './home.component'; import { HomeComponent } from './home.component';
describe('HomeComponent', () => { describe( 'HomeComponent', () => {
let component: HomeComponent; let component: HomeComponent;
let fixture: ComponentFixture<HomeComponent>; let fixture: ComponentFixture<HomeComponent>;
beforeEach(async(() => { beforeEach( async( () => {
TestBed.configureTestingModule({ TestBed.configureTestingModule( {
declarations: [ HomeComponent ] declarations: [ HomeComponent ]
}) } )
.compileComponents(); .compileComponents();
})); } ) );
beforeEach(() => { beforeEach( () => {
fixture = TestBed.createComponent(HomeComponent); fixture = TestBed.createComponent( HomeComponent );
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
}); } );
it('should create', () => { it( 'should create', () => {
expect(component).toBeTruthy(); expect( component ).toBeTruthy();
}); } );
}); } );

View File

@ -1,13 +1,14 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
@Component({ @Component( {
selector: 'app-home', selector: 'app-home',
templateUrl: './home.component.html', templateUrl: './home.component.html',
styleUrls: ['./home.component.css'] styleUrls: [ './home.component.css' ]
}) } )
export class HomeComponent implements OnInit { export class HomeComponent implements OnInit {
constructor() { } constructor() {
}
ngOnInit() { ngOnInit() {
} }

View File

@ -2,24 +2,24 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RegisterComponent } from './register.component'; import { RegisterComponent } from './register.component';
describe('RegisterComponent', () => { describe( 'RegisterComponent', () => {
let component: RegisterComponent; let component: RegisterComponent;
let fixture: ComponentFixture<RegisterComponent>; let fixture: ComponentFixture<RegisterComponent>;
beforeEach(async(() => { beforeEach( async( () => {
TestBed.configureTestingModule({ TestBed.configureTestingModule( {
declarations: [ RegisterComponent ] declarations: [ RegisterComponent ]
}) } )
.compileComponents(); .compileComponents();
})); } ) );
beforeEach(() => { beforeEach( () => {
fixture = TestBed.createComponent(RegisterComponent); fixture = TestBed.createComponent( RegisterComponent );
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
}); } );
it('should create', () => { it( 'should create', () => {
expect(component).toBeTruthy(); expect( component ).toBeTruthy();
}); } );
}); } );

View File

@ -1,13 +1,14 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
@Component({ @Component( {
selector: 'app-register', selector: 'app-register',
templateUrl: './register.component.html', templateUrl: './register.component.html',
styleUrls: ['./register.component.css'] styleUrls: [ './register.component.css' ]
}) } )
export class RegisterComponent implements OnInit { export class RegisterComponent implements OnInit {
constructor() { } constructor() {
}
ngOnInit() { ngOnInit() {
} }