@tapni/auth 0.0.72 → 0.0.74

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.72",
3
+ "version": "0.0.74",
4
4
  "type": "module",
5
5
  "main": "./dist/TapniAuth.umd.js",
6
6
  "module": "./dist/TapniAuth.es.js",
package/src/App.vue CHANGED
@@ -128,7 +128,6 @@ export default {
128
128
  },
129
129
  methods: {
130
130
  async init () {
131
-
132
131
  // Make sure the function is called just once
133
132
  if (this.isSetup) return;
134
133
  this.isSetup = true;
@@ -136,7 +135,9 @@ export default {
136
135
  this.setToken(this.$storage.token);
137
136
  const refreshTokens = this.getRefreshTokens();
138
137
  this.setRefreshToken(refreshTokens[0]);
139
- this.getLoggedInAccounts();
138
+ await this.getLoggedInAccounts();
139
+
140
+ // Let App know that the auth is ready
140
141
  this.$emit('ssoLibraryReady');
141
142
  },
142
143
  ssoOutgoingEvent (data) {
@@ -160,6 +161,12 @@ export default {
160
161
  display () {
161
162
  this.applyBgStyle()
162
163
  },
164
+ '$storageReady.value' (nv) {
165
+ if (nv && this.display === 'npm') {
166
+ // Initialize Library after all event listeners & storage are set
167
+ this.init()
168
+ }
169
+ }
163
170
  }
164
171
  }
165
172
  </script>
@@ -45,8 +45,7 @@ export default {
45
45
  }
46
46
  await this.loginSetup(response)
47
47
  this.getLoggedInAccounts()
48
- // TODO: Pass proper variable isModal
49
- this.loginSuccess({ ...response, isModal: false });
48
+ this.loginSuccess({ ...response, isModal: this.isModal });
50
49
  setTimeout(() => {
51
50
  this.appleLoad = false
52
51
  }, 1000)
@@ -246,7 +246,10 @@ export default {
246
246
  });
247
247
  },
248
248
  async refreshTokenAction(data) {
249
- if (!this.refreshToken || this.refreshing) return;
249
+ if (!this.refreshToken || this.refreshing) {
250
+ console.log('return-refreshTokenAction', this.refreshToken, this.refreshing);
251
+ return;
252
+ }
250
253
 
251
254
  this.refreshing = true;
252
255
  const [err, response] = await to(
@@ -507,12 +510,13 @@ export default {
507
510
 
508
511
  this.$storage.refreshTokens = refreshTokens.join(",");
509
512
 
513
+ EventBus.$emit("setStorage", this.$storage);
510
514
  EventBus.$emit("ssoEvent", { name: "setRefreshToken", data: token });
511
515
  },
512
516
  setToken(token) {
513
517
  this.$storage.token = token;
514
518
  this.token = token;
515
- EventBus.$emit("ssoEvent", { name: "setToken", data: token });
519
+ EventBus.$emit("setStorage", this.$storage);
516
520
  },
517
521
  setUserID(userID) {
518
522
  this.$storage.UserId = userID;
@@ -46,8 +46,7 @@ export default {
46
46
  }
47
47
  await this.loginSetup(response)
48
48
  this.getLoggedInAccounts()
49
- // TODO: Pass proper variable isModal
50
- this.loginSuccess({ ...response, isModal: false });
49
+ this.loginSuccess({ ...response, isModal: this.isModal });
51
50
  setTimeout(() => {
52
51
  this.googleLoad = false
53
52
  }, 1000)
@@ -67,8 +67,7 @@ export default {
67
67
  }
68
68
  await this.loginSetup(response);
69
69
  this.getLoggedInAccounts();
70
- // TODO: Pass proper variable isModal
71
- this.loginSuccess({ ...response, isModal: false });
70
+ this.loginSuccess({ ...response, isModal: this.isModal });
72
71
  setTimeout(() => {
73
72
  this.microsoftLoad = false;
74
73
  this.microsoftSSOLoad = false;