Visiting before login URL is incorrect after callback

Hello. I have a React project and I used React SPA login implementation from here

Have this routing in my app

        <PrivateRoute path="/somedetail/:id" component={SomeDetail} />

Let’s suppose user on this page
http://localhost:3000/somedetail/1 and later decided to go to http://localhost:3000/somedetail/2 by editing an url in a browser and hitting Enter. Login page immediately appears and a user successfully logs in. Callback should put to a browser URL the URL that was before login page, which is http://localhost:3000/somedetail/2 but instead I see http://localhost:3000/exchangedetail/:id in browser.

Can you please say what I am doing wrong?