File tree Expand file tree Collapse file tree
latest-node/my-app/app/routes
min-node/my-app/app/routes Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import Router from '@ember/routing/router' ;
2+ import { inject as service } from '@ember/service' ;
3+
4+ export default Router . extend ( {
5+ currentUser : service ( 'current-user' ) ,
6+
7+ init ( ) {
8+ this . _super ( ...arguments ) ;
9+
10+ this . on ( 'routeWillChange' , transition => {
11+ if ( ! this . currentUser . isLoggedIn ) {
12+ transition . abort ( ) ;
13+ this . transitionTo ( 'login' ) ;
14+ }
15+ } ) ;
16+
17+ this . on ( 'routeDidChange' , transition => {
18+ ga . send ( 'pageView' , {
19+ pageName : privateInfos . name
20+ } ) ;
21+ } ) ;
22+ }
23+ } ) ;
Original file line number Diff line number Diff line change 1+ import Router from '@ember/routing/router' ;
2+ import { inject as service } from '@ember/service' ;
3+
4+ export default Router . extend ( {
5+ currentUser : service ( 'current-user' ) ,
6+
7+ willTransition ( transition ) {
8+ this . _super ( ...arguments ) ;
9+
10+ if ( ! this . currentUser . isLoggedIn ) {
11+ transition . abort ( ) ;
12+ this . transitionTo ( 'login' ) ;
13+ }
14+ } ,
15+
16+ didTransition ( privateInfos ) {
17+ this . _super ( ...arguments ) ;
18+
19+ ga . send ( 'pageView' , {
20+ pageName : privateInfos . name
21+ } ) ;
22+ }
23+ } ) ;
Original file line number Diff line number Diff line change 1+ import Router from '@ember/routing/router' ;
2+ import { inject as service } from '@ember/service' ;
3+
4+ export default Router . extend ( {
5+ currentUser : service ( 'current-user' ) ,
6+
7+ init ( ) {
8+ this . _super ( ...arguments ) ;
9+
10+ this . on ( 'routeWillChange' , transition => {
11+ if ( ! this . currentUser . isLoggedIn ) {
12+ transition . abort ( ) ;
13+ this . transitionTo ( 'login' ) ;
14+ }
15+ } ) ;
16+
17+ this . on ( 'routeDidChange' , transition => {
18+ ga . send ( 'pageView' , {
19+ pageName : privateInfos . name
20+ } ) ;
21+ } ) ;
22+ }
23+ } ) ;
You can’t perform that action at this time.
0 commit comments