Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

redux-token-api-middleware

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-token-api-middleware - npm Package Compare versions

Comparing version 0.8.3 to 0.8.4

13

lib/index.js

@@ -175,8 +175,9 @@ 'use strict';

this.minTokenLifespan = this.config.minTokenLifespan || MIN_TOKEN_LIFESPAN;
this.actionKey = this.config.actionKey || CALL_TOKEN_API;
this.preProcessRequest = this.config.preProcessRequest;
this.refreshToken = this.config.refreshToken || false;
this.shouldRequestNewToken = this.configOrDefault('shouldRequestNewToken');
// bind where needed
this.storeToken = this.storeToken.bind(this, this.tokenStorageKey);
this.retrieveToken = this.retrieveToken.bind(this, this.tokenStorageKey);
this.shouldRequestNewToken = this.shouldRequestNewToken.bind(this);
// this.failureAction = this.configOrNotImplemented('failureAction');

@@ -360,3 +361,4 @@ }

function actionAsPromise(action, dispatch, config) {
var apiAction = action()[CALL_TOKEN_API];
var actionKey = config.actionKey || CALL_TOKEN_API;
var apiAction = action()[actionKey];
if (apiAction) {

@@ -378,6 +380,9 @@ var tokenApiService = new TokenApiService(apiAction, dispatch, config);

var apiAction = action[CALL_TOKEN_API];
var apiAction = action[config.actionKey];
if (apiAction === undefined) {
return next(action);
if (action[CALL_TOKEN_API] === undefined) {
return next(action);
}
apiAction = action[CALL_TOKEN_API];
}

@@ -384,0 +389,0 @@

{
"name": "redux-token-api-middleware",
"version": "0.8.3",
"version": "0.8.4",
"description": "Redux middleware for calling APIs with token-based auth",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -125,8 +125,9 @@ import startsWith from 'lodash.startswith';

this.minTokenLifespan = this.config.minTokenLifespan || MIN_TOKEN_LIFESPAN;
this.actionKey = this.config.actionKey || CALL_TOKEN_API;
this.preProcessRequest = this.config.preProcessRequest;
this.refreshToken = this.config.refreshToken || false;
this.shouldRequestNewToken = this.configOrDefault('shouldRequestNewToken');
// bind where needed
this.storeToken = this.storeToken.bind(this, this.tokenStorageKey);
this.retrieveToken = this.retrieveToken.bind(this, this.tokenStorageKey);
this.shouldRequestNewToken = this.shouldRequestNewToken.bind(this);
// this.failureAction = this.configOrNotImplemented('failureAction');

@@ -156,3 +157,3 @@ }

catchApiRequestError: this.defaultCatchApiRequestError,
checkResponseIsOk: checkResponseIsOk
checkResponseIsOk: checkResponseIsOk,
}

@@ -308,3 +309,4 @@ }

export function actionAsPromise(action, dispatch, config) {
const apiAction = action()[CALL_TOKEN_API];
const actionKey = config.actionKey || CALL_TOKEN_API;
const apiAction = action()[actionKey];
if (apiAction) {

@@ -322,7 +324,9 @@ const tokenApiService = new TokenApiService(apiAction, dispatch, config);

const apiAction = action[CALL_TOKEN_API];
let apiAction = action[config.actionKey]
if (apiAction === undefined) {
return next(action);
if (action[CALL_TOKEN_API] === undefined) {
return next(action);
}
apiAction = action[CALL_TOKEN_API]
}

@@ -329,0 +333,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc