@@ -10,26 +10,26 @@ export class NavigationService {
10
10
constructor ( private backend : BackendService , private config : ConfigService ) {
11
11
}
12
12
13
- getMainNavigation ( ) : Array < GroupItem > {
13
+ async getMainNavigation ( ) : Promise < Array < GroupItem > > {
14
14
return this . checkPermissions ( this . config . getNavigation ( ) ) ;
15
15
}
16
16
17
- getUserNavigation ( ) : Array < Item > {
17
+ async getUserNavigation ( ) : Promise < Array < Item > > {
18
18
return this . checkPermissionItems ( this . config . getUserNavigation ( ) ) ;
19
19
}
20
20
21
- getAnonymousNavigation ( ) : Array < Item > {
21
+ async getAnonymousNavigation ( ) : Promise < Array < Item > > {
22
22
return this . checkPermissionItems ( this . config . getAnonymousNavigation ( ) ) ;
23
23
}
24
24
25
- getAccountNavigation ( ) : Array < Item > {
25
+ async getAccountNavigation ( ) : Promise < Array < Item > > {
26
26
return this . checkPermissionItems ( this . config . getAccountNavigation ( ) ) ;
27
27
}
28
28
29
- private checkPermissions ( navigation : Array < GroupItem > ) : Array < GroupItem > {
29
+ private async checkPermissions ( navigation : Array < GroupItem > ) : Promise < Array < GroupItem > > {
30
30
let result = [ ] ;
31
31
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 ) ;
33
33
if ( children . length > 0 ) {
34
34
let menu = navigation [ i ] ;
35
35
menu . children = children ;
@@ -40,9 +40,9 @@ export class NavigationService {
40
40
return result ;
41
41
}
42
42
43
- private checkPermissionItems ( items : Items ) : Array < Item > {
43
+ private async checkPermissionItems ( items : Items ) : Promise < Array < Item > > {
44
44
if ( items instanceof Function ) {
45
- items = items . apply ( this ) ;
45
+ items = await items . apply ( this ) ;
46
46
}
47
47
48
48
if ( ! Array . isArray ( items ) ) {
@@ -70,7 +70,7 @@ export interface GroupItem {
70
70
children : Items
71
71
}
72
72
73
- export type ItemResolver = ( ) => Array < Item > ;
73
+ export type ItemResolver = ( ) => Promise < Array < Item > > ;
74
74
75
75
export type Items = Array < Item > | ItemResolver ;
76
76
0 commit comments