B
B
Bekkazy2017-10-09 14:01:53
React
Bekkazy, 2017-10-09 14:01:53

How to catch a Request for a page in React + redux?

There is a social login page. After authorization, the server will redirect to the /admin page. How to get the value from request on the /admin page?
There should be information about the user inside.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg Gamega, 2017-10-09
@Bekkazy

when authorizing, write data to redux, redux is the only source of truth do not deviate from this rule
example
may not be the best example but it works stably, when I authorize through social networks, a token arrives in the url

<Route exact path="/"
                                   render={() => {
                                       let token = getParameterByName('accessToken',history.location.search)
                                       if(token!=undefined&& token!=null){
                                           this.props.getProfileInfo(token)
                                       }
                                       return (<Redirect to={`/list/${id}`}/>)
                                   }}
                            />

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question