File tree Expand file tree Collapse file tree 1 file changed +18
-6
lines changed
app/templates/client/components/auth(auth) Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -10,17 +10,29 @@ angular.module('<%= scriptAppName %>.auth')
1010 return ;
1111 }
1212
13- let query = typeof next . authenticate === 'string' ? Auth . hasRole : Auth . isLoggedIn ;
13+ if ( typeof next . authenticate === 'string' ) {
14+ Auth . hasRole ( next . authenticate , _ . noop ) . then ( has => {
15+ if ( has ) {
16+ return ;
17+ }
1418
15- query ( 1 , 2 ) . then ( good => {
16- if ( ! good ) {
1719 event . preventDefault ( ) ;
18- Auth . isLoggedIn ( ) . then ( is => { < % if ( filters . ngroute ) { % >
20+ return Auth . isLoggedIn ( ) . then ( is => { < % if ( filters . ngroute ) { % >
1921 $location . path ( is ? '/' : '/login' ) ; < % } if ( filters . uirouter ) { % >
2022 $state . go ( is ? 'main' : 'login' ) ; < % } % >
2123 } ) ;
22- }
23- } ) ;
24+ } )
25+ } else {
26+ Auth . isLoggedIn ( _ . noop ) . then ( is => {
27+ if ( is ) {
28+ return ;
29+ }
30+
31+ event . preventDefault ( ) ; < % if ( filters . ngroute ) { % >
32+ $location . path ( '/' ) ; < % } if ( filters . uirouter ) { % >
33+ $state . go ( 'main' ) ; < % } % >
34+ } ) ;
35+ }
2436 } ) ;
2537 } ) ;
2638
You can’t perform that action at this time.
0 commit comments