I am creating a react
SPA application and I am using tokens that are refreshed on every request to any authenticated route.
On 401
/Unauthrorized
for any of these AJAX
requests, I prompt the user with a popup/modal that requests the user to login so that they don't have to lose the state of their current page.
I could redirect them to the login page and then back but they would lose any current state unless I persisted it somehow, but that seems like unnecessary complexity.
The problem is that after the initial failed AJAX
request, more AJAX requests could occur. So if I just redo the initial failed AJAX
request then it will not be correct. I'm thinking that I could save all the failed request promises and then re-resolve them after the user has re-authenticated.
Is the proper high level approach?
Aucun commentaire:
Enregistrer un commentaire