Created
September 12, 2025 15:25
-
-
Save Juan-Severiano/b75b63b775000936ea9f6cf16ab06203 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| api.interceptors.response.use( | |
| (res) => res, | |
| async (error) => { | |
| if (error.response?.status === 401) { | |
| // Aqui pode-se implementar algo para fazer quando der um erro 401 (ou qualquer outro) | |
| // Ex. pode chamar uma rota de revalidação de token, ou simplesmente deslogar o user | |
| } | |
| return Promise.reject(error) | |
| }, | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment