Skip to content
Snippets Groups Projects
Commit e2340cb9 authored by Daniel Kovacs's avatar Daniel Kovacs
Browse files

asd

parent 87fedc2a
No related branches found
No related tags found
No related merge requests found
...@@ -71,9 +71,9 @@ app.get('/callback', function (req, res) { ...@@ -71,9 +71,9 @@ app.get('/callback', function (req, res) {
let uri = process.env.FRONTEND_URI || 'http://localhost:3000/' let uri = process.env.FRONTEND_URI || 'http://localhost:3000/'
uri= uri + '?access_token=' + access_token uri= uri + '?access_token=' + access_token
console.log(req.query.state); console.log(req.query.state);
if (req.query.state.hasOwnProperty('from')){ if (req.query.state){
console.log("sdfdfdf") console.log("sdfdfdf")
uri=uri+`&from=${req.query.state.from}` uri=uri+`&from=${encodeURI(req.query.state)}`
} }
console.log(uri); console.log(uri);
res.redirect(uri) res.redirect(uri)
......
...@@ -9,17 +9,24 @@ class Landing extends Component{ ...@@ -9,17 +9,24 @@ class Landing extends Component{
if(this.props.auth.isAuthenticated){ if(this.props.auth.isAuthenticated){
this.props.history.push(`/`); this.props.history.push(`/`);
} else { } else {
const {access_token} = queryString.parse(window.location.search); const {access_token,from} = queryString.parse(window.location.search);
console.log(access_token + " "+ from);
if (access_token) this.props.loginUser(access_token); if (access_token) this.props.loginUser(access_token);
} }
} }
componentWillReceiveProps(nextProps){ componentWillReceiveProps(nextProps){
console.log(this.props) const {from} = queryString.parse(window.location.search);
console.log(nextProps) if(nextProps.auth.isAuthenticated)
// if(nextProps.auth.isAuthenticated){ {
// this.props.history.push('/dashboard'); if(from){
// } this.props.history.push('/'+decodeURI(from));
}else{
this.props.history.push('/dashboard');
}
}
} }
render(){ render(){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment