roboto-js 1.0.17 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/rbt_api.cjs +7 -5
- package/dist/esm/rbt_api.js +7 -5
- package/package.json +1 -1
- package/src/rbt_api.js +5 -5
package/dist/cjs/rbt_api.cjs
CHANGED
|
@@ -445,20 +445,22 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
445
445
|
key: "configure",
|
|
446
446
|
value: function configure(_ref) {
|
|
447
447
|
var apiKey = _ref.apiKey,
|
|
448
|
-
baseUrl = _ref.baseUrl
|
|
448
|
+
baseUrl = _ref.baseUrl,
|
|
449
|
+
authtoken = _ref.authtoken,
|
|
450
|
+
accesskey = _ref.accesskey;
|
|
449
451
|
if (!RbtApi.instance) {
|
|
450
452
|
var isClient = typeof window !== 'undefined';
|
|
451
|
-
var
|
|
453
|
+
var authTokenToUse = isClient && !authtoken ? localStorage.getItem('authtoken') : authtoken;
|
|
452
454
|
console.log('RbtApi authtoken ' + authtoken);
|
|
453
455
|
var axiosInstance = _axios["default"].create({
|
|
454
456
|
baseURL: baseUrl,
|
|
455
457
|
headers: {
|
|
456
|
-
accesskey: apiKey,
|
|
457
|
-
authtoken:
|
|
458
|
+
'accesskey': accesskey || apiKey,
|
|
459
|
+
'authtoken': authTokenToUse
|
|
458
460
|
}
|
|
459
461
|
});
|
|
460
462
|
RbtApi.instance = new RbtApi(axiosInstance);
|
|
461
|
-
RbtApi.instance.authtoken =
|
|
463
|
+
RbtApi.instance.authtoken = authTokenToUse;
|
|
462
464
|
}
|
|
463
465
|
return RbtApi.instance;
|
|
464
466
|
}
|
package/dist/esm/rbt_api.js
CHANGED
|
@@ -445,20 +445,22 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
445
445
|
key: "configure",
|
|
446
446
|
value: function configure(_ref) {
|
|
447
447
|
var apiKey = _ref.apiKey,
|
|
448
|
-
baseUrl = _ref.baseUrl
|
|
448
|
+
baseUrl = _ref.baseUrl,
|
|
449
|
+
authtoken = _ref.authtoken,
|
|
450
|
+
accesskey = _ref.accesskey;
|
|
449
451
|
if (!RbtApi.instance) {
|
|
450
452
|
var isClient = typeof window !== 'undefined';
|
|
451
|
-
var
|
|
453
|
+
var authTokenToUse = isClient && !authtoken ? localStorage.getItem('authtoken') : authtoken;
|
|
452
454
|
console.log('RbtApi authtoken ' + authtoken);
|
|
453
455
|
var axiosInstance = _axios["default"].create({
|
|
454
456
|
baseURL: baseUrl,
|
|
455
457
|
headers: {
|
|
456
|
-
accesskey: apiKey,
|
|
457
|
-
authtoken:
|
|
458
|
+
'accesskey': accesskey || apiKey,
|
|
459
|
+
'authtoken': authTokenToUse
|
|
458
460
|
}
|
|
459
461
|
});
|
|
460
462
|
RbtApi.instance = new RbtApi(axiosInstance);
|
|
461
|
-
RbtApi.instance.authtoken =
|
|
463
|
+
RbtApi.instance.authtoken = authTokenToUse;
|
|
462
464
|
}
|
|
463
465
|
return RbtApi.instance;
|
|
464
466
|
}
|
package/package.json
CHANGED
package/src/rbt_api.js
CHANGED
|
@@ -14,23 +14,23 @@ export default class RbtApi {
|
|
|
14
14
|
this.authtoken = null;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
static configure({ apiKey, baseUrl }) {
|
|
17
|
+
static configure({ apiKey, baseUrl, authtoken, accesskey }) {
|
|
18
18
|
if (!RbtApi.instance) {
|
|
19
19
|
const isClient = typeof window !== 'undefined';
|
|
20
20
|
|
|
21
|
-
const
|
|
21
|
+
const authTokenToUse = isClient && !authtoken ? localStorage.getItem('authtoken') : authtoken;
|
|
22
22
|
|
|
23
23
|
console.log('RbtApi authtoken '+authtoken);
|
|
24
24
|
const axiosInstance = axios.create({
|
|
25
25
|
baseURL: baseUrl,
|
|
26
26
|
headers: {
|
|
27
|
-
accesskey: apiKey,
|
|
28
|
-
authtoken:
|
|
27
|
+
'accesskey': accesskey || apiKey,
|
|
28
|
+
'authtoken': authTokenToUse
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
RbtApi.instance = new RbtApi(axiosInstance);
|
|
33
|
-
RbtApi.instance.authtoken =
|
|
33
|
+
RbtApi.instance.authtoken = authTokenToUse;
|
|
34
34
|
}
|
|
35
35
|
return RbtApi.instance;
|
|
36
36
|
}
|