File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -78,24 +78,26 @@ const Public = () => <h3>Public</h3>
78
78
79
79
////////////////////////////////////////////////////////////
80
80
class Login extends React . Component {
81
- static contextTypes = {
82
- location : PropTypes . object ,
83
- router : PropTypes . object
81
+
82
+ state = {
83
+ redirectToReferrer : false
84
84
}
85
85
86
86
login = ( ) => {
87
- const { location } = this . props
88
-
89
87
fakeAuth . authenticate ( ( ) => {
90
- this . context . router . replaceWith ( location . state . from )
88
+ this . setState ( { redirectToReferrer : true } )
91
89
} )
92
90
}
93
91
94
92
render ( ) {
95
93
const { from } = this . props . location . state
94
+ const { redirectToReferrer } = this . state
96
95
97
96
return (
98
97
< div >
98
+ { redirectToReferrer && (
99
+ < Redirect to = { from || '/' } />
100
+ ) }
99
101
{ from && (
100
102
< p >
101
103
You must log in to view the page at
You can’t perform that action at this time.
0 commit comments