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

redux-api-request

Package Overview
Dependencies
Maintainers
4
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-api-request - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

5

dist/index.js

@@ -14,2 +14,3 @@ "use strict";

var _lodash = /*#__PURE__*/ _interopRequireDefault(require("lodash"));
var _qs = /*#__PURE__*/ _interopRequireDefault(require("qs"));
function _arrayLikeToArray(arr, len) {

@@ -171,5 +172,6 @@ if (len == null || len > arr.length) len = arr.length;

} : {});
var endpoint = action.endpoint.substr(0, 4) !== "http" ? "".concat(defaultHost).concat(action.endpoint) : action.endpoint;
var method = action.method ? action.method.toUpperCase() : "GET";
var url = action.endpoint.substr(0, 4) !== "http" ? "".concat(defaultHost).concat(action.endpoint) : action.endpoint;
var query = action.query && method === "GET" ? action.query : null;
var url = query ? "".concat(endpoint, "?").concat(_qs.default.stringify(action.query)) : endpoint;
var data = action.body && method !== "GET" ? action.body : null;

@@ -222,3 +224,2 @@ var params = action.body || action.query;

method: method,
params: query,
data: data

@@ -225,0 +226,0 @@ }).then(success).catch(failure);

{
"name": "redux-api-request",
"version": "2.0.1",
"version": "2.0.2",
"description": "Redux middleware for making api requests",

@@ -39,4 +39,5 @@ "license": "ISC",

"axios": "^0.27.2",
"lodash": "^4.17.4"
"lodash": "^4.17.4",
"qs": "^6.11.0"
}
}

8

src/index.js
import * as actionTypes from './action_types'
import axios from 'axios'
import _ from 'lodash'
import qs from 'qs'

@@ -23,8 +24,10 @@ export default (options = {}) => {

const endpoint = action.endpoint.substr(0,4) !== 'http' ? `${defaultHost}${action.endpoint}` : action.endpoint
const method = action.method ? action.method.toUpperCase() : 'GET'
const url = action.endpoint.substr(0,4) !== 'http' ? `${defaultHost}${action.endpoint}` : action.endpoint
const query = action.query && method === 'GET' ? action.query : null
const url = query ? `${endpoint}?${qs.stringify(action.query)}` : endpoint
const data = action.body && method !== 'GET' ? action.body : null

@@ -89,3 +92,2 @@

method,
params: query,
data

@@ -92,0 +94,0 @@ }).then(success).catch(failure)

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