Commit 1b30e88d authored by Tomáš Biloš's avatar Tomáš Biloš
Browse files

add auth guard

parent 9b8c939b
Pipeline #141964 waiting for manual action with stage
......@@ -5,6 +5,7 @@ import { AgentListComponent } from './agent/agent-list.component';
import { AssignmentCreateComponent } from './assignment/assignment-create.component';
import { AssignmentDetailComponent } from './assignment/assignment-detail.component';
import { AuthComponent } from './auth/auth.component';
import { AuthGuard } from './auth/auth.guard';
import { CountryDetailComponent } from './country/country-detail.component';
import { CountryListComponent } from './country/country-list.component';
import { HomeComponent } from './home/home.component';
......@@ -17,6 +18,7 @@ const routes: Routes = [
{
path: 'auth',
component: AuthComponent,
canActivate: [AuthGuard],
children: [
{ path: '', component: HomeComponent, pathMatch: 'full' },
{ path: 'agent/:id', component: AgentDetailComponent },
......
......@@ -3,7 +3,7 @@
<mat-icon>home</mat-icon>
</button>
<div>Secret archive</div>
<button mat-icon-button routerLink="/">
<button mat-icon-button routerLink="/" (click)="logOut()">
<mat-icon>logout</mat-icon>
</button>
</div>
......
import { Component } from '@angular/core';
import { AuthService } from './auth.service';
@Component({ selector: 'auth', templateUrl: './auth.component.html' })
export class AuthComponent {}
export class AuthComponent {
constructor(private authService: AuthService) {}
logOut() {
this.authService.logout();
}
}
......@@ -6,7 +6,6 @@ import { environment } from '../../environments/environment';
import { RequestState } from '../request-state.enum';
import { Mission } from './mission.interface';
interface MissionTableItem {
id: string;
name: string;
......@@ -40,8 +39,4 @@ export class MissionListComponent implements OnInit {
throw err;
}
}
goToMissionDetail(missionId: string) {
this.router.navigate(['mission', missionId]);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment