import { NgModule } from '@angular/core';
import { Routes, RouterModule, PreloadAllModules } from '@angular/router';
import { APP_PAGES } from '@app_consts';
import { ACCOUNT_PAGE, Globals, LOGIN_PAGE } from '@app_core/services/globals';

ACCOUNT_PAGE.loadChildren = () => import('@app_modules/app-account/app-account.module').then(m => m.AppAccountModule);

const routes: Routes = [
  ...APP_PAGES,
  {
    path: '',
    redirectTo: '/' + LOGIN_PAGE.path,
    pathMatch: 'full'
  }
];

@NgModule({
  imports: [RouterModule.forRoot(routes, { useHash: true, preloadingStrategy: PreloadAllModules })],
  exports: [RouterModule]
})
export class AppRoutingModule { public globals: Globals; }
