@@ -10,26 +10,26 @@ export class NavigationService {
1010 constructor ( private backend : BackendService , private config : ConfigService ) {
1111 }
1212
13- getMainNavigation ( ) : Array < GroupItem > {
13+ async getMainNavigation ( ) : Promise < Array < GroupItem > > {
1414 return this . checkPermissions ( this . config . getNavigation ( ) ) ;
1515 }
1616
17- getUserNavigation ( ) : Array < Item > {
17+ async getUserNavigation ( ) : Promise < Array < Item > > {
1818 return this . checkPermissionItems ( this . config . getUserNavigation ( ) ) ;
1919 }
2020
21- getAnonymousNavigation ( ) : Array < Item > {
21+ async getAnonymousNavigation ( ) : Promise < Array < Item > > {
2222 return this . checkPermissionItems ( this . config . getAnonymousNavigation ( ) ) ;
2323 }
2424
25- getAccountNavigation ( ) : Array < Item > {
25+ async getAccountNavigation ( ) : Promise < Array < Item > > {
2626 return this . checkPermissionItems ( this . config . getAccountNavigation ( ) ) ;
2727 }
2828
29- private checkPermissions ( navigation : Array < GroupItem > ) : Array < GroupItem > {
29+ private async checkPermissions ( navigation : Array < GroupItem > ) : Promise < Array < GroupItem > > {
3030 let result = [ ] ;
3131 for ( let i = 0 ; i < navigation . length ; i ++ ) {
32- const children = this . checkPermissionItems ( navigation [ i ] . children ) ;
32+ const children = await this . checkPermissionItems ( navigation [ i ] . children ) ;
3333 if ( children . length > 0 ) {
3434 let menu = navigation [ i ] ;
3535 menu . children = children ;
@@ -40,9 +40,9 @@ export class NavigationService {
4040 return result ;
4141 }
4242
43- private checkPermissionItems ( items : Items ) : Array < Item > {
43+ private async checkPermissionItems ( items : Items ) : Promise < Array < Item > > {
4444 if ( items instanceof Function ) {
45- items = items . apply ( this ) ;
45+ items = await items . apply ( this ) ;
4646 }
4747
4848 if ( ! Array . isArray ( items ) ) {
@@ -70,7 +70,7 @@ export interface GroupItem {
7070 children : Items
7171}
7272
73- export type ItemResolver = ( ) => Array < Item > ;
73+ export type ItemResolver = ( ) => Promise < Array < Item > > ;
7474
7575export type Items = Array < Item > | ItemResolver ;
7676
0 commit comments