Début d'ajout pour la gestion du login

This commit is contained in:
Sébastien André
2020-03-11 11:22:35 +01:00
parent bf695b431c
commit 8a29fd7de9
19 changed files with 296 additions and 39 deletions

View File

@@ -17,9 +17,9 @@ import { NewGearComponent } from './new-gear/new-gear.component';
import { NewDropZoneComponent } from './new-drop-zone/new-drop-zone.component';
import { NewJumpTypeComponent } from './new-jump-type/new-jump-type.component';
import { DefaultComponent } from './default/default.component';
import { LoginComponent } from './login/login.component';
import { DateService } from '../services/date.service';
import { AircraftService } from '../services/aircraft.service';
import { DropzoneService } from '../services/dropzone.service';
import { GearService } from '../services/gear.service';
@@ -27,6 +27,8 @@ import { JumpService } from '../services/jump.service';
import { JumpTypeService } from '../services/jump-type.service';
import { StatsService } from '../services/stats.service';
import { ServiceComm } from '../services/service-comm.service';
import { RequestCache } from '../services/request-cache.service';
import { AuthGuardService } from '../services/auth-guard.service';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
@@ -43,19 +45,23 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatSelectModule } from '@angular/material/select';
import { MatTableModule } from '@angular/material/table';
import { RequestCache } from '../services/request-cache.service';
import { CachingInterceptor } from '../services/caching-interceptor.service';
import { CachingInterceptor } from '../interceptor/caching.interceptor';
import { BasicAuthInterceptor } from '../interceptor/basic-auth.interceptor';
import { ErrorInterceptor } from '../interceptor/error.interceptor';
const appRoutes: Routes = [
{ path: '', component: DefaultComponent },
{ path: '', component: DefaultComponent, canActivate: [AuthGuardService] },
{ path: 'summary', component: SummaryComponent },
{ path: 'jumps', component: ListOfJumpsComponent },
{ path: 'dzs', component: ListOfDzsComponent },
{ path: 'newjump', component: NewJumpComponent },
{ path: 'aircrafts', component: ListOfAircraftsComponent },
{ path: 'jumpTypes', component: ListOfJumpTypesComponent },
{ path: 'gears', component: ListOfGearsComponent },
{ path: 'summary', component: SummaryComponent, canActivate: [AuthGuardService] },
{ path: 'jumps', component: ListOfJumpsComponent, canActivate: [AuthGuardService] },
{ path: 'dzs', component: ListOfDzsComponent, canActivate: [AuthGuardService] },
{ path: 'newjump', component: NewJumpComponent, canActivate: [AuthGuardService] },
{ path: 'aircrafts', component: ListOfAircraftsComponent, canActivate: [AuthGuardService] },
{ path: 'jumpTypes', component: ListOfJumpTypesComponent, canActivate: [AuthGuardService] },
{ path: 'gears', component: ListOfGearsComponent, canActivate: [AuthGuardService] },
{ path: 'login', component: LoginComponent },
{ path: '**', redirectTo: '' }
];
@@ -74,7 +80,8 @@ const appRoutes: Routes = [
NewGearComponent,
NewDropZoneComponent,
NewJumpTypeComponent,
DefaultComponent
DefaultComponent,
LoginComponent
],
imports: [
RouterModule.forRoot(
@@ -111,6 +118,8 @@ const appRoutes: Routes = [
DateService,
RequestCache,
// { provide: HTTP_INTERCEPTORS, useClass: CachingInterceptor, multi: true }
{ provide: HTTP_INTERCEPTORS, useClass: BasicAuthInterceptor, multi: true },
{ provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true },
],
bootstrap: [AppComponent]
})