Skip to content

Instantly share code, notes, and snippets.

View dumazy's full-sized avatar

Fré Dumazy dumazy

View GitHub Profile
@dumazy
dumazy / axios.refresh_token.js
Created January 2, 2019 12:58 — forked from Godofbrowser/axios.refresh_token.1.js
Axios interceptor for refresh token when you have multiple parallel requests
// for multiple requests
let isRefreshing = false;
let failedQueue = [];
const processQueue = (error, token = null) => {
failedQueue.forEach(prom => {
if (error) {
prom.reject(error);
} else {
prom.resolve(token);