frontend/src/app/app-routing.module.ts

36 lines
905 B
TypeScript
Raw Normal View History

2020-02-08 02:01:00 +00:00
import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
import {LoginPage} from './pages/login/login.page';
import {AuthService} from './service/auth.service';
import {GuestOnlyGuard} from './service/guard/GuestOnly.guard';
2020-02-08 02:01:00 +00:00
const routes: Routes = [
{
path: '',
redirectTo: 'home',
pathMatch: 'full'
},
{
path: 'home',
canActivate: [AuthService],
2020-02-08 02:01:00 +00:00
loadChildren: () => import('./home/home.module').then(m => m.HomePageModule)
},
2020-02-08 09:36:14 +00:00
{
path: 'editor',
loadChildren: () => import('./components/components.module').then( m => m.ComponentsModule)
},
{
path: 'login',
canActivate: [GuestOnlyGuard],
component: LoginPage,
2020-02-08 02:01:00 +00:00
}
];
@NgModule({
imports: [
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
export class AppRoutingModule {}