1
- export function RoutesRun ( $rootScope , $state , $auth , AclService , $timeout ) {
1
+ export function RoutesRun ( $rootScope , $state , $auth , AclService , $timeout , API , ContextService ) {
2
2
'ngInject'
3
3
4
4
AclService . resume ( )
@@ -15,8 +15,9 @@ export function RoutesRun ($rootScope, $state, $auth, AclService, $timeout) {
15
15
$rootScope . bodyClass = 'hold-transition login-page'
16
16
} )
17
17
18
- function fixSideBar ( ) {
18
+ function stateChange ( ) {
19
19
$timeout ( function ( ) {
20
+ // fix sidebar
20
21
var neg = $ ( '.main-header' ) . outerHeight ( ) + $ ( '.main-footer' ) . outerHeight ( )
21
22
var window_height = $ ( window ) . height ( )
22
23
var sidebar_height = $ ( '.sidebar' ) . height ( )
@@ -30,10 +31,19 @@ export function RoutesRun ($rootScope, $state, $auth, AclService, $timeout) {
30
31
$ ( '.content-wrapper, .right-side' ) . css ( 'min-height' , sidebar_height )
31
32
}
32
33
}
34
+
35
+ // get user current context
36
+ if ( $auth . isAuthenticated ( ) && ! $rootScope . me ) {
37
+ ContextService . getContext ( )
38
+ . then ( ( response ) => {
39
+ response = response . plain ( )
40
+ $rootScope . me = response . data
41
+ } )
42
+ }
33
43
} )
34
44
}
35
45
36
46
$rootScope . $on ( '$destroy' , deregisterationCallback )
37
- $rootScope . $on ( '$stateChangeSuccess' , fixSideBar )
47
+ $rootScope . $on ( '$stateChangeSuccess' , stateChange )
38
48
/*eslint-enable */
39
49
}
0 commit comments