Merge pull request #3348 from alfonso-salces/MOBILE-4081

MOBILE-4081 courses: Load 'my.module' from service
main
Noel De Martin 2022-08-04 15:03:43 +02:00 committed by GitHub
commit eb632cc9e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -15,6 +15,7 @@
import { Injector, NgModule } from '@angular/core';
import { RouterModule, ROUTES, Routes } from '@angular/router';
import { buildTabMainRoutes } from '@features/mainmenu/mainmenu-tab-routing.module';
import { CoreCoursesHelper } from './services/courses-helper';
import { CoreCoursesMyCoursesMainMenuHandlerService } from './services/handlers/my-courses-mainmenu';
function buildRoutes(injector: Injector): Routes {
@ -24,7 +25,7 @@ function buildRoutes(injector: Injector): Routes {
data: {
mainMenuTabRoot: CoreCoursesMyCoursesMainMenuHandlerService.PAGE_NAME,
},
loadChildren: () => import('./pages/my/my.module').then(m => m.CoreCoursesMyCoursesPageModule),
loadChildren: () => CoreCoursesHelper.getMyRouteModule(),
},
{
path: 'categories',

View File

@ -339,6 +339,15 @@ export class CoreCoursesHelperProvider {
return startDate > Date.now();
}
/**
* Retrieves my courses page module.
*
* @returns My courses page module.
*/
async getMyRouteModule(): Promise<unknown> {
return import('../pages/my/my.module').then(m => m.CoreCoursesMyCoursesPageModule);
}
}
export const CoreCoursesHelper = makeSingleton(CoreCoursesHelperProvider);