@shoutem/api-sdk
Advanced tools
Comparing version 1.1.9 to 1.1.10
@@ -81,8 +81,2 @@ 'use strict'; | ||
}); | ||
Object.defineProperty(exports, 'extendShouldIntercept', { | ||
enumerable: true, | ||
get: function get() { | ||
return _fetchTokenIntercept.extendShouldIntercept; | ||
} | ||
}); | ||
@@ -89,0 +83,0 @@ var _settings = require('./services/settings'); |
@@ -7,3 +7,2 @@ 'use strict'; | ||
exports.initializeFetchTokenInterceptor = initializeFetchTokenInterceptor; | ||
exports.extendShouldIntercept = extendShouldIntercept; | ||
@@ -61,4 +60,7 @@ var _lodash = require('lodash'); | ||
// eslint-disable-next-line max-len | ||
// array defining additional endpoints for regex matching | ||
var additionalEndpoints = '|' + _lodash2.default.join(additionalApiEndpoints, '|'); | ||
var apiSubdomainRegex = new RegExp('^([.a-z0-9]*?).*(localhost|' + baseApi + additionalEndpoints + ')', 'g'); | ||
return function (request) { | ||
@@ -68,2 +70,3 @@ // add auth headers only if we're accessing known API endpoints | ||
var requestHostname = requestUri.hostname(); | ||
var authRequired = requestHostname.match(apiSubdomainRegex); | ||
@@ -120,15 +123,2 @@ var returnValue = authRequired && request.url !== authTokenEndpoint && request.url !== authSessionEndpoint; | ||
fetchTokenIntercept.authorize(refreshToken); | ||
} | ||
function extendShouldIntercept(config) { | ||
var _config$url2 = config.url, | ||
baseApi = _config$url2.baseApi, | ||
additionalApiEndpoints = _config$url2.additionalApiEndpoints; | ||
var configuration = { | ||
shouldIntercept: shouldIntercept(baseApi, additionalApiEndpoints) | ||
}; | ||
fetchTokenIntercept.configure(configuration); | ||
} |
{ | ||
"name": "@shoutem/api-sdk", | ||
"version": "1.1.9", | ||
"version": "1.1.10", | ||
"description": "Javascript SDK for Shoutem API using fetch", | ||
@@ -18,3 +18,4 @@ "main": "build/lib/index.js", | ||
"test": "mocha --require babelTestSetup --reporter spec --recursive test", | ||
"lint": "eslint src test" | ||
"lint": "eslint src test", | ||
"publish": "npm publish --access public --tag latest" | ||
}, | ||
@@ -48,2 +49,2 @@ "devDependencies": { | ||
} | ||
} | ||
} |
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
30811
666