Updated routes and app component

This commit is contained in:
Jim Martens 2021-09-18 20:17:25 +02:00
parent f9fb93a57c
commit c9cfb64c4e
2 changed files with 41 additions and 14 deletions

View File

@ -1,14 +1,30 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {StatisticsComponent} from "./statistics/statistics.component";
import {AdministrationComponent} from './auth/administration/administration.component';
import {FactionsComponent} from './auth/administration/factions/factions.component';
import {LoginComponent} from './login/login.component';
import {LogoutComponent} from './logout/logout.component';
import {AuthGuard} from './auth/auth.guard';
const routes: Routes = [
{ path: 'statistics', component: StatisticsComponent },
{ path: '', redirectTo: 'statistics', pathMatch: 'full' }
{path: 'statistics', component: StatisticsComponent},
{
path: 'administration',
component: AdministrationComponent,
children: [
{path: 'factions', component: FactionsComponent},
],
canActivate: [AuthGuard]
},
{path: 'login', component: LoginComponent},
{path: 'logout', component: LogoutComponent, canActivate: [AuthGuard]},
{path: '', redirectTo: 'statistics', pathMatch: 'full'}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
export class AppRoutingModule {
}

View File

@ -1,22 +1,33 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {FormsModule} from '@angular/forms';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { NavbarComponent } from './navbar/navbar.component';
import { StatisticsComponent } from './statistics/statistics.component';
import {AppRoutingModule} from './app-routing.module';
import {AppComponent} from './app.component';
import {NavbarComponent} from './navbar/navbar.component';
import {StatisticsComponent} from './statistics/statistics.component';
import {LoginComponent} from './login/login.component';
import {AdministrationComponent} from './auth/administration/administration.component';
import {FactionsComponent} from './auth/administration/factions/factions.component';
import {LogoutComponent} from './logout/logout.component';
@NgModule({
declarations: [
AppComponent,
NavbarComponent,
StatisticsComponent
StatisticsComponent,
AdministrationComponent,
FactionsComponent,
LoginComponent,
LogoutComponent
],
imports: [
BrowserModule,
AppRoutingModule
AppRoutingModule,
FormsModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
export class AppModule {
}