redux-token-api-middleware
Advanced tools
Comparing version 0.8.3 to 0.8.4
@@ -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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6352825
1720