authscape 1.0.86 → 1.0.88

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/.babelrc CHANGED
@@ -1,3 +1,3 @@
1
- {
2
- "presets": ["@babel/preset-react", "@babel/preset-env"]
1
+ {
2
+ "presets": ["@babel/preset-react", "@babel/preset-env"]
3
3
  }
package/index.js CHANGED
@@ -391,7 +391,7 @@ var setupDefaultOptions = /*#__PURE__*/function () {
391
391
 
392
392
  var RefreshToken = /*#__PURE__*/function () {
393
393
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(originalRequest, instance) {
394
- var accessToken, refreshToken, response, domain;
394
+ var accessToken, refreshToken, response;
395
395
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
396
396
  while (1) {
397
397
  switch (_context2.prev = _context2.next) {
@@ -415,39 +415,38 @@ var RefreshToken = /*#__PURE__*/function () {
415
415
  response = _context2.sent;
416
416
 
417
417
  if (!(response != null && response.status == 200)) {
418
- _context2.next = 14;
418
+ _context2.next = 13;
419
419
  break;
420
420
  }
421
421
 
422
422
  originalRequest.headers['Authorization'] = 'Bearer ' + response.data.access_token;
423
- domain = getCookieDomain();
424
- _context2.next = 10;
423
+ _context2.next = 9;
425
424
  return (0, _nookies.setCookie)(null, "access_token", response.data.access_token, {
426
425
  maxAge: 2147483647,
427
426
  path: '/',
428
- domain: domain,
427
+ domain: process.env.cookieDomain,
429
428
  secure: true
430
429
  });
431
430
 
432
- case 10:
433
- _context2.next = 12;
431
+ case 9:
432
+ _context2.next = 11;
434
433
  return (0, _nookies.setCookie)(null, "expires_in", response.data.expires_in, {
435
434
  maxAge: 2147483647,
436
435
  path: '/',
437
- domain: domain,
436
+ domain: process.env.cookieDomain,
438
437
  secure: true
439
438
  });
440
439
 
441
- case 12:
442
- _context2.next = 14;
440
+ case 11:
441
+ _context2.next = 13;
443
442
  return (0, _nookies.setCookie)(null, "refresh_token", response.data.refresh_token, {
444
443
  maxAge: 2147483647,
445
444
  path: '/',
446
- domain: domain,
445
+ domain: process.env.cookieDomain,
447
446
  secure: true
448
447
  });
449
448
 
450
- case 14:
449
+ case 13:
451
450
  case "end":
452
451
  return _context2.stop();
453
452
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authscape",
3
- "version": "1.0.86",
3
+ "version": "1.0.88",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/index.js CHANGED
@@ -1,13 +1,13 @@
1
- import React, { Component } from 'react';
2
-
3
- export default class DummyComponent extends Component {
4
-
5
- render () {
6
-
7
- return (
8
- <div>I am a dummy react npm module</div>
9
- )
10
-
11
- }
12
-
1
+ import React, { Component } from 'react';
2
+
3
+ export default class DummyComponent extends Component {
4
+
5
+ render () {
6
+
7
+ return (
8
+ <div>I am a dummy react npm module</div>
9
+ )
10
+
11
+ }
12
+
13
13
  }
@@ -59,13 +59,11 @@ const RefreshToken = async (originalRequest, instance) => {
59
59
  {
60
60
  originalRequest.headers['Authorization'] = 'Bearer ' + response.data.access_token;
61
61
 
62
- let domain = getCookieDomain();
63
-
64
62
  await setCookie(null, "access_token", response.data.access_token,
65
63
  {
66
64
  maxAge: 2147483647,
67
65
  path: '/',
68
- domain: domain,
66
+ domain: process.env.cookieDomain,
69
67
  secure: true
70
68
  });
71
69
 
@@ -73,7 +71,7 @@ const RefreshToken = async (originalRequest, instance) => {
73
71
  {
74
72
  maxAge: 2147483647,
75
73
  path: '/',
76
- domain: domain,
74
+ domain: process.env.cookieDomain,
77
75
  secure: true
78
76
  });
79
77
 
@@ -81,7 +79,7 @@ const RefreshToken = async (originalRequest, instance) => {
81
79
  {
82
80
  maxAge: 2147483647,
83
81
  path: '/',
84
- domain: domain,
82
+ domain: process.env.cookieDomain,
85
83
  secure: true
86
84
  });
87
85
  }
@@ -217,6 +215,10 @@ export const apiService = (ctx = {}) => {
217
215
  {
218
216
  return response.data;
219
217
  }
218
+ // else if (response != null && response.status == 401)
219
+ // {
220
+ // // call the login window maybe?
221
+ // }
220
222
  }
221
223
 
222
224
  } catch(exp) {