roboto-js 1.3.1 → 1.3.3

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.
@@ -37,10 +37,9 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
37
37
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
38
38
  var Roboto = exports["default"] = /*#__PURE__*/function () {
39
39
  function Roboto(_ref) {
40
- var _ref$proxyReq = _ref.proxyReq,
41
- proxyReq = _ref$proxyReq === void 0 ? null : _ref$proxyReq,
42
- host = _ref.host,
40
+ var host = _ref.host,
43
41
  apiKey = _ref.apiKey;
42
+ var proxyReq = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
44
43
  _classCallCheck(this, Roboto);
45
44
  if (Roboto.instance && !proxyReq) {
46
45
  // if on client, there can only be one instance
@@ -55,7 +54,7 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
55
54
  };
56
55
 
57
56
  // DEVELOPMENT
58
- this.config.baseUrl = this._stripHttpsForDomains(this.config.baseUrl, ['localhost', 'rbt.dorfio.com']);
57
+ this.config.baseUrl = this._stripHttpsForDomains(this.config.baseUrl, ['localhost', 'rbt.dorfio.com', 'srv.dorfio.com']);
59
58
 
60
59
  // Check if a request object is provided
61
60
  if (proxyReq && proxyReq.headers) {
@@ -32,7 +32,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
32
32
  accesskey = _ref.accesskey;
33
33
  _classCallCheck(this, RbtApi);
34
34
  var isClient = typeof window !== 'undefined';
35
- var authTokenToUse = isClient && !authtoken ? localStorage.getItem('authtoken') : authtoken;
35
+ var authTokenToUse = isClient && !authtoken && typeof localStorage != 'undefined' ? localStorage.getItem('authtoken') : authtoken;
36
36
  this.axios = _axios["default"].create({
37
37
  baseURL: baseUrl,
38
38
  headers: {
package/dist/esm/index.js CHANGED
@@ -7,10 +7,9 @@ export { RbtApi, RbtObject, RbtFile
7
7
  };
8
8
  export default class Roboto {
9
9
  constructor({
10
- proxyReq = null,
11
10
  host,
12
11
  apiKey
13
- }) {
12
+ }, proxyReq = null) {
14
13
  if (Roboto.instance && !proxyReq) {
15
14
  // if on client, there can only be one instance
16
15
  // on server, with proxyReq, each request has its own instance
@@ -24,7 +23,7 @@ export default class Roboto {
24
23
  };
25
24
 
26
25
  // DEVELOPMENT
27
- this.config.baseUrl = this._stripHttpsForDomains(this.config.baseUrl, ['localhost', 'rbt.dorfio.com']);
26
+ this.config.baseUrl = this._stripHttpsForDomains(this.config.baseUrl, ['localhost', 'rbt.dorfio.com', 'srv.dorfio.com']);
28
27
 
29
28
  // Check if a request object is provided
30
29
  if (proxyReq && proxyReq.headers) {
@@ -13,7 +13,7 @@ export default class RbtApi {
13
13
  accesskey
14
14
  }) {
15
15
  const isClient = typeof window !== 'undefined';
16
- const authTokenToUse = isClient && !authtoken ? localStorage.getItem('authtoken') : authtoken;
16
+ const authTokenToUse = isClient && !authtoken && typeof localStorage != 'undefined' ? localStorage.getItem('authtoken') : authtoken;
17
17
  this.axios = axios.create({
18
18
  baseURL: baseUrl,
19
19
  headers: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roboto-js",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "dist/cjs/index.cjs",
package/src/index.js CHANGED
@@ -13,8 +13,8 @@ export {
13
13
 
14
14
  export default class Roboto{
15
15
 
16
- constructor({ proxyReq = null, host, apiKey }) {
17
-
16
+ constructor({ host, apiKey }, proxyReq = null) {
17
+
18
18
  if (Roboto.instance && !proxyReq) {
19
19
  // if on client, there can only be one instance
20
20
  // on server, with proxyReq, each request has its own instance
@@ -29,7 +29,7 @@ export default class Roboto{
29
29
  };
30
30
 
31
31
  // DEVELOPMENT
32
- this.config.baseUrl = this._stripHttpsForDomains(this.config.baseUrl, ['localhost', 'rbt.dorfio.com']);
32
+ this.config.baseUrl = this._stripHttpsForDomains(this.config.baseUrl, ['localhost', 'rbt.dorfio.com', 'srv.dorfio.com']);
33
33
 
34
34
  // Check if a request object is provided
35
35
  if (proxyReq && proxyReq.headers) {
package/src/rbt_api.js CHANGED
@@ -11,7 +11,7 @@ export default class RbtApi {
11
11
  constructor({ apiKey, baseUrl, authtoken, accesskey }) {
12
12
 
13
13
  const isClient = typeof window !== 'undefined';
14
- const authTokenToUse = isClient && !authtoken ? localStorage.getItem('authtoken') : authtoken;
14
+ const authTokenToUse = isClient && !authtoken && typeof localStorage != 'undefined' ? localStorage.getItem('authtoken') : authtoken;
15
15
 
16
16
  this.axios = axios.create({
17
17
  baseURL: baseUrl,