tenjin-ui-kit 0.2.20 → 0.2.22

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.
@@ -55,51 +55,50 @@ var AuthenticationProvider = function AuthenticationProvider(_ref) {
55
55
  while (1) switch (_context.prev = _context.next) {
56
56
  case 0:
57
57
  token = resolveToken();
58
+ console.log("Resolved Token: ", token);
58
59
  if (!token) {
59
- _context.next = 16;
60
+ _context.next = 19;
60
61
  break;
61
62
  }
62
- _context.prev = 2;
63
- _context.next = 5;
63
+ _context.prev = 3;
64
+ console.log("Calling profile validation API");
65
+ _context.next = 7;
64
66
  return _axios.default.get("/api/me", {
65
67
  headers: {
66
68
  Authorization: "Bearer ".concat(token)
67
69
  }
68
70
  });
69
- case 5:
71
+ case 7:
70
72
  profileValidationResponse = _context.sent;
73
+ console.log("Profile validation successful");
71
74
  setLoggedInUser(profileValidationResponse.data);
72
75
  setAuthLoading(false);
73
- _context.next = 14;
76
+ _context.next = 17;
74
77
  break;
75
- case 10:
76
- _context.prev = 10;
77
- _context.t0 = _context["catch"](2);
78
+ case 13:
79
+ _context.prev = 13;
80
+ _context.t0 = _context["catch"](3);
81
+ console.error("Profile validation error");
78
82
  setLoggedInUser(null);
79
- redirectToLogin();
80
- case 14:
81
- _context.next = 17;
83
+ // redirectToLogin();
84
+ case 17:
85
+ _context.next = 20;
82
86
  break;
83
- case 16:
87
+ case 19:
84
88
  redirectToLogin();
85
- case 17:
89
+ case 20:
86
90
  case "end":
87
91
  return _context.stop();
88
92
  }
89
- }, _callee, null, [[2, 10]]);
93
+ }, _callee, null, [[3, 13]]);
90
94
  }));
91
95
  return function resolveAuthentication() {
92
96
  return _ref2.apply(this, arguments);
93
97
  };
94
98
  }();
95
99
  var redirectToLogin = function redirectToLogin() {
96
- // const redirectUrl =
97
- // process.env.NODE_ENV === "production"
98
- // ? location.pathname
99
- // : `${window.location.protocol}//${window.location.hostname}:${window.location.port}${location.pathname}`;
100
- // window.location.href =
101
- // process.env.REACT_APP_LOGIN_URL +
102
- // `?redirect_url=${encodeURIComponent(redirectUrl)}`;
100
+ var redirectUrl = process.env.NODE_ENV === "production" ? location.pathname : "".concat(window.location.protocol, "//").concat(window.location.hostname, ":").concat(window.location.port).concat(location.pathname);
101
+ window.location.href = process.env.REACT_APP_LOGIN_URL + "?redirect_url=".concat(encodeURIComponent(redirectUrl));
103
102
  };
104
103
  var clearTokenFromSearchParams = function clearTokenFromSearchParams() {
105
104
  searchParams.delete(LS_ACCESS_TOKEN_KEY);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tenjin-ui-kit",
3
- "version": "0.2.20",
3
+ "version": "0.2.22",
4
4
  "repository": {
5
5
  "url": "https://gitlab.com/yethi/react/tenjin-ui-kit.git"
6
6
  },