Redid 404 and 500 routing, and redid authguard to point to /login

This commit is contained in:
Tom Bloor 2017-08-15 16:12:55 +01:00
parent 20330bc220
commit 8939c18335
3 changed files with 18 additions and 20 deletions

View file

@ -15,7 +15,7 @@ export class AuthGuard implements CanActivate {
// not logged in so redirect to login page with the return url
console.log('no session key found')
this.router.navigate(['/pages/login'], { queryParams: { returnUrl: state.url }});
this.router.navigate(['/login'], { queryParams: { returnUrl: state.url }});
return false;
}
}

View file

@ -21,6 +21,10 @@ import { AuthGuard } from './_guards/auth.guard';
import { FullLayoutComponent } from './layouts/full-layout.component';
import { SimpleLayoutComponent } from './layouts/simple-layout.component';
// Error Pages
import { P404Component } from './pages/404.component';
import { P500Component } from './pages/500.component';
// Submodules
import { AuthModule } from './auth/auth.module';
@ -42,6 +46,8 @@ import { AuthModule } from './auth/auth.module';
BreadcrumbsComponent,
SIDEBAR_TOGGLE_DIRECTIVES,
AsideToggleDirective,
P404Component,
P500Component,
],
providers: [
AuthGuard,

View file

@ -6,10 +6,13 @@ import { AuthGuard } from './_guards/auth.guard';
import { FullLayoutComponent } from './layouts/full-layout.component';
import { SimpleLayoutComponent } from './layouts/simple-layout.component';
import { P404Component } from './pages/404.component';
import { P500Component } from './pages/500.component';
export const routes: Routes = [
{
path: '',
redirectTo: 'dashboard',
redirectTo: '/dashboard',
pathMatch: 'full',
},
{
@ -38,19 +41,8 @@ export const routes: Routes = [
}
]
},
{
path: 'pages',
component: SimpleLayoutComponent,
data: {
title: 'Pages'
},
children: [
{
path: '',
loadChildren: './pages/pages.module#PagesModule',
}
]
}
{ path: '404', component: P404Component },
{ path: '500', component: P500Component },
];
@NgModule({