Skip to content

Instantly share code, notes, and snippets.

View hnakao's full-sized avatar

Hiroshi Nakao hnakao

  • HISEO
View GitHub Profile
@Godofbrowser
Godofbrowser / axios.refresh_token.1.js
Last active November 10, 2024 14:36 — forked from culttm/axios.refresh_token.js
Axios interceptor for refresh token when you have multiple parallel requests. Demo implementation: https://github.com/Godofbrowser/axios-refresh-multiple-request
// 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);