Closed yildiraykoyuncu closed 3 years ago
@yildiraykoyuncu
Not 100% convinced about this solution. I have the impression, correct me if I'm wrong, that we will need to adapt every component in the application. If the application grows, this can become very error-prone
Idea is to bring a 'generic' mechanism into play. eg:
<Route
path="/some-path"
render={() => !isAuthenticated ?
<Login/> :
<Redirect to="/some-path" />
}/>
What do you think ?
Other (different, non-router-based) frontend inspiration food https://medium.com/javascript-in-plain-english/authentication-in-react-caf2abfa0494
https://codesandbox.io/s/dazzling-cloud-u6hg7?from-embed=&file=/src/protectedPage.js
fixed the token expiration problem. instead of giving an error now, it redirects the user to the login page