How to use the redux-api-middleware.apiMiddleware function in redux-api-middleware

To help you get started, we’ve selected a few redux-api-middleware examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github viewflow / cookbook / _articles / redux_jwt_auth / frontend / src / middleware.js View on Github external
return ({ dispatch, getState }) => {
    const rsaaMiddleware = apiMiddleware({dispatch, getState})

    return (next) => (action) => {
      const nextCheckPostoned = (nextAction) => {
          // Run postponed actions after token refresh
          if (nextAction.type === TOKEN_RECEIVED) {
            next(nextAction);
            postponedRSAAs.forEach((postponed) => {
              rsaaMiddleware(next)(postponed)
            })
            postponedRSAAs = []
          } else {
            next(nextAction)
          }
      }

      if(isRSAA(action)) {
github FredHutch / motuz / src / frontend / js / middleware / authMiddleware.jsx View on Github external
return ({ dispatch, getState }) => {
        const rsaaMiddleware = apiMiddleware({dispatch, getState});

        return (next) => (action) => {
            const nextCheckPostoned = (nextAction) => {
                // Run postponed actions after token refresh
                if (nextAction.type === REFRESH_TOKEN_SUCCESS) {
                    next(nextAction);
                    postponedRSAAs.forEach((postponed) => {
                        rsaaMiddleware(next)(postponed);
                    });
                    postponedRSAAs = [];
                } else {
                    next(nextAction);
                }
            };

            if(isRSAA(action)) {
github cern-phone-apps / desktop-phone-app / webapp / src / middleware.js View on Github external
return ({ dispatch, getState }) => {
    const rsaaMiddleware = apiMiddleware({ dispatch, getState });

    return processNextAction(postponedRSAAs, rsaaMiddleware, getState);
  };
}
github cern-phone-apps / desktop-phone-app / src / middleware.js View on Github external
return ({ dispatch, getState }) => {
    const rsaaMiddleware = apiMiddleware({ dispatch, getState });

    return processNextAction(postponedRSAAs, rsaaMiddleware);
  };
}
github amaurymartiny / timed / app / client / src / middleware / api.js View on Github external
case 'TRACKS':
            schema = arrayOf(trackSchema)
            break
          case 'WEBSITE':
            schema = websiteSchema
            break
          case 'WEBSITES':
            schema = arrayOf(websiteSchema)
            break
          default:
            schema = null
        }
        return getJSON(res).then(json => normalize(json, schema))
      }
    }
    return apiMiddleware(store)(next)(action)
  }
}
github cern-phone-apps / desktop-phone-app / mobile / middleware.js View on Github external
return ({ dispatch, getState }) => {
    const rsaaMiddleware = apiMiddleware({ dispatch, getState });

    return processNextAction(postponedRSAAs, rsaaMiddleware, getState);
  };
}