File tree Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -41,21 +41,16 @@ class App extends React.Component {
41
41
}
42
42
43
43
var requireAuth = ( Component ) => {
44
- class Authenticated extends React . Component {
44
+ return class Authenticated extends React . Component {
45
+ static willTransitionTo ( transition ) {
46
+ if ( ! auth . loggedIn ( ) ) {
47
+ transition . redirect ( '/login' , { } , { 'nextPath' : transition . path } ) ;
48
+ }
49
+ }
45
50
render ( ) {
46
51
return < Component { ...this . props } />
47
52
}
48
53
}
49
-
50
- Authenticated . willTransitionTo = function ( transition ) {
51
- var nextPath = transition . path ;
52
- if ( ! auth . loggedIn ( ) ) {
53
- transition . redirect ( '/login' , { } ,
54
- { 'nextPath' : nextPath } ) ;
55
- }
56
- } ;
57
-
58
- return Authenticated ;
59
54
} ;
60
55
61
56
var Dashboard = requireAuth ( class extends React . Component {
You can’t perform that action at this time.
0 commit comments