redux-query
Advanced tools
Comparing version 1.1.0-alpha.0 to 1.1.0-alpha.1
@@ -55,2 +55,24 @@ 'use strict'; | ||
var createRequest = function createRequest(url, method) { | ||
var request = void 0; | ||
switch (method) { | ||
case httpMethods.GET: | ||
request = _superagent2.default.get(url); | ||
break; | ||
case httpMethods.POST: | ||
request = _superagent2.default.post(url); | ||
break; | ||
case httpMethods.PUT: | ||
request = _superagent2.default.put(url); | ||
break; | ||
case httpMethods.DELETE: | ||
request = _superagent2.default.del(url); | ||
break; | ||
default: | ||
throw new Error('Unsupported HTTP method: ' + method); | ||
} | ||
return request; | ||
}; | ||
var updateEntities = function updateEntities(update, entities, transformed) { | ||
@@ -143,20 +165,3 @@ // If update, not supplied, then no change to entities should be made | ||
var request = void 0; | ||
switch (method) { | ||
case httpMethods.GET: | ||
request = _superagent2.default.get(url); | ||
break; | ||
case httpMethods.POST: | ||
request = _superagent2.default.post(url); | ||
break; | ||
case httpMethods.PUT: | ||
request = _superagent2.default.put(url); | ||
break; | ||
case httpMethods.DELETE: | ||
request = _superagent2.default.del(url); | ||
break; | ||
default: | ||
console.error('Unsupported HTTP method: ' + method); | ||
return; | ||
} | ||
var request = createRequest(url, method); | ||
@@ -249,4 +254,8 @@ if (body) { | ||
var start = new Date(); | ||
var request = _superagent2.default.post(url); | ||
var _options$method2 = options.method, | ||
method = _options$method2 === undefined ? httpMethods.POST : _options$method2; | ||
var request = createRequest(url, method); | ||
if (options.headers) { | ||
@@ -253,0 +262,0 @@ request.set(options.headers); |
@@ -55,2 +55,24 @@ 'use strict'; | ||
var createRequest = function createRequest(url, method) { | ||
var request = void 0; | ||
switch (method) { | ||
case httpMethods.GET: | ||
request = _superagent2.default.get(url); | ||
break; | ||
case httpMethods.POST: | ||
request = _superagent2.default.post(url); | ||
break; | ||
case httpMethods.PUT: | ||
request = _superagent2.default.put(url); | ||
break; | ||
case httpMethods.DELETE: | ||
request = _superagent2.default.del(url); | ||
break; | ||
default: | ||
throw new Error('Unsupported HTTP method: ' + method); | ||
} | ||
return request; | ||
}; | ||
var updateEntities = function updateEntities(update, entities, transformed) { | ||
@@ -143,20 +165,3 @@ // If update, not supplied, then no change to entities should be made | ||
var request = void 0; | ||
switch (method) { | ||
case httpMethods.GET: | ||
request = _superagent2.default.get(url); | ||
break; | ||
case httpMethods.POST: | ||
request = _superagent2.default.post(url); | ||
break; | ||
case httpMethods.PUT: | ||
request = _superagent2.default.put(url); | ||
break; | ||
case httpMethods.DELETE: | ||
request = _superagent2.default.del(url); | ||
break; | ||
default: | ||
console.error('Unsupported HTTP method: ' + method); | ||
return; | ||
} | ||
var request = createRequest(url, method); | ||
@@ -249,4 +254,8 @@ if (body) { | ||
var start = new Date(); | ||
var request = _superagent2.default.post(url); | ||
var _options$method2 = options.method, | ||
method = _options$method2 === undefined ? httpMethods.POST : _options$method2; | ||
var request = createRequest(url, method); | ||
if (options.headers) { | ||
@@ -253,0 +262,0 @@ request.set(options.headers); |
{ | ||
"name": "redux-query", | ||
"version": "1.1.0-alpha.0", | ||
"version": "1.1.0-alpha.1", | ||
"description": "A library for querying and managing network state in React/Redux applications", | ||
@@ -5,0 +5,0 @@ "main": "dist/commonjs/index.js", |
@@ -22,2 +22,24 @@ import Backoff from 'backo'; | ||
const createRequest = (url, method) => { | ||
let request; | ||
switch (method) { | ||
case httpMethods.GET: | ||
request = superagent.get(url); | ||
break; | ||
case httpMethods.POST: | ||
request = superagent.post(url); | ||
break; | ||
case httpMethods.PUT: | ||
request = superagent.put(url); | ||
break; | ||
case httpMethods.DELETE: | ||
request = superagent.del(url); | ||
break; | ||
default: | ||
throw new Error(`Unsupported HTTP method: ${method}`); | ||
} | ||
return request; | ||
}; | ||
const updateEntities = (update, entities, transformed) => { | ||
@@ -101,20 +123,3 @@ // If update, not supplied, then no change to entities should be made | ||
let request; | ||
switch (method) { | ||
case httpMethods.GET: | ||
request = superagent.get(url); | ||
break; | ||
case httpMethods.POST: | ||
request = superagent.post(url); | ||
break; | ||
case httpMethods.PUT: | ||
request = superagent.put(url); | ||
break; | ||
case httpMethods.DELETE: | ||
request = superagent.del(url); | ||
break; | ||
default: | ||
console.error(`Unsupported HTTP method: ${method}`); | ||
return; | ||
} | ||
const request = createRequest(url, method); | ||
@@ -124,3 +129,3 @@ if (body) { | ||
} | ||
if (options.headers) { | ||
@@ -214,8 +219,10 @@ request.set(options.headers); | ||
const start = new Date(); | ||
const request = superagent.post(url); | ||
const { method = httpMethods.POST } = options; | ||
const request = createRequest(url, method); | ||
if (options.headers) { | ||
request.set(options.headers); | ||
} | ||
// Note: only the entities that are included in `optimisticUpdate` will be passed along in the | ||
@@ -222,0 +229,0 @@ // `mutateStart` action as `optimisticEntities` |
Sorry, the diff of this file is too big to display
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
2956
221749