convert-slow-api
Advanced tools
Comparing version 1.0.10 to 1.0.11
@@ -68,11 +68,11 @@ "use strict"; | ||
case 0: | ||
config = __assign({ optimized: true, interval: 1000, errorHandler: error_handler_1.default() }, conf); | ||
config = __assign({ optimized: true, interval: 1000, getConfig: { | ||
timeout: 10 * 1000 | ||
}, postConfig: {}, errorHandler: error_handler_1.default() }, conf); | ||
if (!!config.optimized) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, exports.axios.post(url, params)]; | ||
return [4 /*yield*/, exports.axios.post(url, params, config.postConfig)]; | ||
case 1: | ||
res = _b.sent(); | ||
return [2 /*return*/, res.data]; | ||
case 2: return [4 /*yield*/, exports.axios.post(url, params, { | ||
params: { optimized: 'true' } | ||
})]; | ||
case 2: return [4 /*yield*/, exports.axios.post(url, params, __assign(__assign({}, config.postConfig), { params: { optimized: 'true' } }))]; | ||
case 3: | ||
@@ -90,5 +90,3 @@ id = (_b.sent()).data.id; | ||
_b.trys.push([6, 8, , 9]); | ||
return [4 /*yield*/, exports.axios.get(url, { | ||
params: { id: id }, | ||
})]; | ||
return [4 /*yield*/, exports.axios.get(url, __assign(__assign({}, config.getConfig), { params: { id: id } }))]; | ||
case 7: | ||
@@ -95,0 +93,0 @@ _a = (_b.sent()).data, result = _a.result, error = _a.error, finished = _a.finished; |
{ | ||
"name": "convert-slow-api", | ||
"version": "1.0.10", | ||
"version": "1.0.11", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/get-router.js", |
@@ -14,2 +14,6 @@ import Axios from "axios" | ||
interval: 1000, | ||
getConfig: { | ||
timeout: 10 * 1000 | ||
}, | ||
postConfig: {}, | ||
errorHandler: getErrorHandle(), | ||
@@ -19,6 +23,7 @@ ...conf, | ||
if (!config.optimized) { | ||
let res = await axios.post(url, params) | ||
let res = await axios.post(url, params, config.postConfig) | ||
return res.data | ||
} | ||
let { data: { id } } = await axios.post(url, params, { | ||
...config.postConfig, | ||
params: { optimized: 'true' } | ||
@@ -31,2 +36,3 @@ }) | ||
let { data: { result, error, finished } } = await axios.get(url, { | ||
...config.getConfig, | ||
params: { id }, | ||
@@ -33,0 +39,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
28946
594