Log error
This commit is contained in:
1 parent
d0df896ea4
commit
aed9feb357
2 files changed
+11
-1
No files matched your search
@@ -93,6 +93,7 @@ class BrightpearlClient {
|
|||||||
|
|
||||||
this.client_.interceptors.response.use(undefined, async (error) => {
|
this.client_.interceptors.response.use(undefined, async (error) => {
|
||||||
const response = error.response
|
const response = error.response
|
||||||
|
console.log(response)
|
||||||
|
|
||||||
if (response) {
|
if (response) {
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ exports["default"] = void 0;
|
|||||||
|
|
||||||
var _axios = _interopRequireDefault(require("axios"));
|
var _axios = _interopRequireDefault(require("axios"));
|
||||||
|
|
||||||
|
var _axiosRateLimit = _interopRequireDefault(require("axios-rate-limit"));
|
||||||
|
|
||||||
var _querystring = _interopRequireDefault(require("querystring"));
|
var _querystring = _interopRequireDefault(require("querystring"));
|
||||||
|
|
||||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||||
@@ -25,6 +27,10 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|||||||
|
|
||||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||||
|
|
||||||
|
// Brightpearl allows 200 requests per minute
|
||||||
|
var RATE_LIMIT_REQUESTS = 200;
|
||||||
|
var RATE_LIMIT_INTERVAL = 60 * 1000;
|
||||||
|
|
||||||
var BrightpearlClient = /*#__PURE__*/function () {
|
var BrightpearlClient = /*#__PURE__*/function () {
|
||||||
_createClass(BrightpearlClient, null, [{
|
_createClass(BrightpearlClient, null, [{
|
||||||
key: "createToken",
|
key: "createToken",
|
||||||
@@ -282,12 +288,15 @@ var BrightpearlClient = /*#__PURE__*/function () {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
this.client_ = _axios["default"].create({
|
this.client_ = (0, _axiosRateLimit["default"])(_axios["default"].create({
|
||||||
baseURL: "https://".concat(options.url, "/public-api/").concat(options.account),
|
baseURL: "https://".concat(options.url, "/public-api/").concat(options.account),
|
||||||
headers: {
|
headers: {
|
||||||
"brightpearl-app-ref": "medusa-dev",
|
"brightpearl-app-ref": "medusa-dev",
|
||||||
"brightpearl-dev-ref": "sebrindom"
|
"brightpearl-dev-ref": "sebrindom"
|
||||||
}
|
}
|
||||||
|
}), {
|
||||||
|
maxRequests: RATE_LIMIT_REQUESTS,
|
||||||
|
perMilliseconds: RATE_LIMIT_INTERVAL
|
||||||
});
|
});
|
||||||
this.authType_ = options.auth_type;
|
this.authType_ = options.auth_type;
|
||||||
this.token_ = options.access_token;
|
this.token_ = options.access_token;
|
||||||
|
|||||||
Reference in new issue
Block a user