1

i so far handled logging in and access to the routes using a privateRoute component but if the token expires the user will be kicked out and should login again

export const PrivateRoute = ({component: Component, ...res}) => (
<Route
{...res}
render={props =>
  (localStorage.getItem('access-token') && (new Date().getTime() / 1000) <= parseInt(localStorage.getItem('expires-at')) ) ?
    (<Component
      {...props} />) :
    (<Redirect
      to={{
        pathname: '/login',
        state: {from:props.location}
}}/>)
}
/>
)

i want to set the refreshToken request without kicking the user out and i dont want to use redux

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.