@tapni/auth 0.0.76 → 0.0.78

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapni/auth",
3
- "version": "0.0.76",
3
+ "version": "0.0.78",
4
4
  "type": "module",
5
5
  "main": "./dist/TapniAuth.umd.js",
6
6
  "module": "./dist/TapniAuth.es.js",
@@ -102,15 +102,13 @@ export default {
102
102
  error.response.data &&
103
103
  error.response.data.error
104
104
  ) {
105
- if (
106
- error.response.data.error === "ACCESS_DENIED" ||
107
- error.response.data.error === "TOKEN_EXPIRED"
108
- ) {
105
+ if (error.response.data.error === "ACCESS_DENIED") {
109
106
  return this.logout();
110
107
  }
111
108
  // Link click network error bug fix
112
109
  if (
113
110
  !error.response.data.error.includes("Network Error") &&
111
+ !error.response.data.error.includes("TOKEN_EXPIRED") &&
114
112
  !error.response.data.error.includes("Cannot read properties")
115
113
  ) {
116
114
  this.errorSnack(error.response.data.error);
@@ -246,6 +244,7 @@ export default {
246
244
  });
247
245
  },
248
246
  async refreshTokenAction(data) {
247
+ console.log('auth-refreshTokenAction', data);
249
248
  if (!this.refreshToken || this.refreshing) {
250
249
  console.log('return-refreshTokenAction', this.refreshToken, this.refreshing);
251
250
  return;
@@ -267,6 +266,7 @@ export default {
267
266
  // Set new access token
268
267
  if (response && response.data) {
269
268
  this.setToken(response.data.token);
269
+ EventBus.$emit("ssoEvent", { name: "setStorage", data: this.$storage });
270
270
  } else console.error('Invalid response setToken');
271
271
  this.refreshing = false;
272
272
  },
@@ -53,6 +53,8 @@ export default {
53
53
  if (storage && storage.token && !refreshTokenAction) {
54
54
  const decoded = jwtDecode(storage.token)
55
55
 
56
+ console.log('interceptor enter', decoded, decoded.exp - 30 < Math.floor(Date.now() / 1000));
57
+
56
58
  // Check if access token expired
57
59
  if (decoded.exp - 30 < Math.floor(Date.now() / 1000)) {
58
60
 
@@ -71,4 +73,4 @@ export default {
71
73
 
72
74
  return apiInstance;
73
75
  }
74
- }
76
+ }