React Native - logout user if api status code is 401 (unauthorized)

When a user registers or registers, he will generate a token with our web server and store it on the user's mobile phone. Every time the API makes a call, the token should be checked by our web server to see if the user is allowed.

Now, if the token has expired, it will return a 401 status code. I wonder how I should handle it?

Our applications use reduction and reduction, it can be very easily done in gearboxes, but gearboxes are divided into different modules, which means that I have to do this everywhere.

If you all need information, I will update my post.

+4
source share

Source: https://habr.com/ru/post/1687507/


All Articles