roboto-js 1.6.0 → 1.6.1

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.
@@ -64,12 +64,8 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
64
64
  this.requestCache = {};
65
65
 
66
66
  // Use the storageAdaptor to get the authToken, if available
67
- if (authtoken) {
68
- this.initAuthToken(authtoken);
69
- }
70
- if (apikey) {
71
- this.initApiKey(apikey);
72
- }
67
+ this.initAuthToken(authtoken);
68
+ this.initApiKey(apikey);
73
69
  }
74
70
  _createClass(RbtApi, [{
75
71
  key: "initAuthToken",
@@ -87,9 +83,11 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
87
83
  case 3:
88
84
  authtoken = _context.sent;
89
85
  case 4:
90
- this.authtoken = authtoken;
91
- this.axios.defaults.headers.common['authtoken'] = this.authtoken;
92
- case 6:
86
+ if (authtoken) {
87
+ this.authtoken = authtoken;
88
+ this.axios.defaults.headers.common['authtoken'] = this.authtoken;
89
+ }
90
+ case 5:
93
91
  case "end":
94
92
  return _context.stop();
95
93
  }
@@ -116,9 +114,11 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
116
114
  case 3:
117
115
  apikey = _context2.sent;
118
116
  case 4:
119
- this.apikey = apikey;
120
- this.axios.defaults.headers.common['apikey'] = this.apikey;
121
- case 6:
117
+ if (apikey) {
118
+ this.apikey = apikey;
119
+ this.axios.defaults.headers.common['apikey'] = this.apikey;
120
+ }
121
+ case 5:
122
122
  case "end":
123
123
  return _context2.stop();
124
124
  }
@@ -36,26 +36,26 @@ export default class RbtApi {
36
36
  this.requestCache = {};
37
37
 
38
38
  // Use the storageAdaptor to get the authToken, if available
39
- if (authtoken) {
40
- this.initAuthToken(authtoken);
41
- }
42
- if (apikey) {
43
- this.initApiKey(apikey);
44
- }
39
+ this.initAuthToken(authtoken);
40
+ this.initApiKey(apikey);
45
41
  }
46
42
  async initAuthToken(authtoken) {
47
43
  if (!authtoken && this.localStorageAdaptor) {
48
44
  authtoken = await this.localStorageAdaptor.getItem('authtoken');
49
45
  }
50
- this.authtoken = authtoken;
51
- this.axios.defaults.headers.common['authtoken'] = this.authtoken;
46
+ if (authtoken) {
47
+ this.authtoken = authtoken;
48
+ this.axios.defaults.headers.common['authtoken'] = this.authtoken;
49
+ }
52
50
  }
53
51
  async initApiKey(apikey) {
54
52
  if (!apikey && this.localStorageAdaptor) {
55
53
  apikey = await this.localStorageAdaptor.getItem('apikey');
56
54
  }
57
- this.apikey = apikey;
58
- this.axios.defaults.headers.common['apikey'] = this.apikey;
55
+ if (apikey) {
56
+ this.apikey = apikey;
57
+ this.axios.defaults.headers.common['apikey'] = this.apikey;
58
+ }
59
59
  }
60
60
  async initLocalDb() {
61
61
  this.localDb = await openDB('RBTFileDatabase', 1, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roboto-js",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "dist/cjs/index.cjs",
package/src/rbt_api.js CHANGED
@@ -35,13 +35,9 @@ export default class RbtApi {
35
35
  this.requestCache = {};
36
36
 
37
37
  // Use the storageAdaptor to get the authToken, if available
38
- if(authtoken){
39
- this.initAuthToken(authtoken);
40
- }
41
- if(apikey){
42
- this.initApiKey(apikey);
43
- }
44
-
38
+ this.initAuthToken(authtoken);
39
+ this.initApiKey(apikey);
40
+
45
41
  }
46
42
 
47
43
  async initAuthToken(authtoken) {
@@ -50,9 +46,10 @@ export default class RbtApi {
50
46
  authtoken = await this.localStorageAdaptor.getItem('authtoken');
51
47
  }
52
48
 
53
- this.authtoken = authtoken;
54
- this.axios.defaults.headers.common['authtoken'] = this.authtoken;
55
-
49
+ if(authtoken){
50
+ this.authtoken = authtoken;
51
+ this.axios.defaults.headers.common['authtoken'] = this.authtoken;
52
+ }
56
53
  }
57
54
 
58
55
  async initApiKey(apikey) {
@@ -61,8 +58,10 @@ export default class RbtApi {
61
58
  apikey = await this.localStorageAdaptor.getItem('apikey');
62
59
  }
63
60
 
64
- this.apikey = apikey;
65
- this.axios.defaults.headers.common['apikey'] = this.apikey;
61
+ if(apikey){
62
+ this.apikey = apikey;
63
+ this.axios.defaults.headers.common['apikey'] = this.apikey;
64
+ }
66
65
 
67
66
  }
68
67