redux-api-request
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -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" | ||
} | ||
} |
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) |
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
161287
855
3
+ Addedqs@^6.11.0
+ Addedcall-bind-apply-helpers@1.0.1(transitive)
+ Addedcall-bound@1.0.3(transitive)
+ Addeddunder-proto@1.0.1(transitive)
+ Addedes-define-property@1.0.1(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-object-atoms@1.0.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-intrinsic@1.2.6(transitive)
+ Addedgopd@1.2.0(transitive)
+ Addedhas-symbols@1.1.0(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedmath-intrinsics@1.1.0(transitive)
+ Addedobject-inspect@1.13.3(transitive)
+ Addedqs@6.13.1(transitive)
+ Addedside-channel@1.1.0(transitive)
+ Addedside-channel-list@1.0.0(transitive)
+ Addedside-channel-map@1.0.1(transitive)
+ Addedside-channel-weakmap@1.0.2(transitive)