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.6 to 0.8.7

23

lib/index.js

@@ -259,2 +259,11 @@ 'use strict';

}, {
key: 'getToken',
value: async function getToken() {
var token = this.retrieveToken();
if (token instanceof Promise) {
return await token;
}
return token;
}
}, {
key: 'defaultAddTokenToRequest',

@@ -305,10 +314,11 @@ value: function defaultAddTokenToRequest(headers, endpoint, body, token) {

key: 'call',
value: function call() {
value: async function call() {
var _this2 = this;
var token = await this.getToken();
if (this.shouldRequestNewToken()) {
var refreshAction = this.refreshAction(this.token);
var refreshAction = this.refreshAction(token);
var refreshApiAction = refreshAction[CALL_TOKEN_API];
var refreshApiActionMeta = refreshApiAction.meta || {};
var refreshArgs = this.getApiFetchArgsFromActionPayload(refreshApiAction.payload, this.token, refreshApiActionMeta.authenticate);
var refreshArgs = this.getApiFetchArgsFromActionPayload(refreshApiAction.payload, token, refreshApiActionMeta.authenticate);
return _crossFetch2.default.apply(null, refreshArgs).then(this.checkResponseIsOk).then(responseToCompletion).then(this.storeToken).then(function (token) {

@@ -320,3 +330,3 @@ _this2.curriedApiCallMethod(token);

} else {
return this.curriedApiCallMethod(this.token);
return this.curriedApiCallMethod(token);
}

@@ -348,7 +358,2 @@ }

}
}, {
key: 'token',
get: function get() {
return this.retrieveToken();
}
}]);

@@ -355,0 +360,0 @@

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

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

@@ -156,3 +156,3 @@ import startsWith from 'lodash.startswith';

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

@@ -233,4 +233,8 @@ }

get token() {
return this.retrieveToken();
async getToken() {
const token = this.retrieveToken()
if (token instanceof Promise) {
return await token;
}
return token;
}

@@ -275,5 +279,6 @@

call() {
async call() {
const token = await this.getToken();
if (this.shouldRequestNewToken()) {
const refreshAction = this.refreshAction(this.token);
const refreshAction = this.refreshAction(token);
const refreshApiAction = refreshAction[CALL_TOKEN_API];

@@ -283,3 +288,3 @@ const refreshApiActionMeta = refreshApiAction.meta || {};

refreshApiAction.payload,
this.token,
token,
refreshApiActionMeta.authenticate

@@ -298,6 +303,5 @@ );

} else {
return this.curriedApiCallMethod(this.token);
return this.curriedApiCallMethod(token);
}
}
}

@@ -304,0 +308,0 @@

Sorry, the diff of this file is too big to display

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