@tapni/auth 0.0.33 → 0.0.34

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.33",
3
+ "version": "0.0.34",
4
4
  "type": "module",
5
5
  "main": "./dist/TapniAuth.umd.js",
6
6
  "module": "./dist/TapniAuth.es.js",
package/src/App.vue CHANGED
@@ -122,13 +122,18 @@ export default {
122
122
  },
123
123
  methods: {
124
124
  async init () {
125
- if (this.$storage && this.$storage.token && this.$storage.refreshTokens) {
126
- this.setToken(this.$storage.token);
127
- const refreshTokens = this.getRefreshTokens();
128
- this.setRefreshToken(refreshTokens[0]);
129
- this.getLoggedInAccounts();
130
- }
125
+
126
+ // Make sure the function is called just once
127
+ if (this.initialized) return;
131
128
  this.initialized = true;
129
+
130
+ // Make sure the storage is ready
131
+ if (!this.$storageReady.value) return;
132
+
133
+ this.setToken(this.$storage.token);
134
+ const refreshTokens = this.getRefreshTokens();
135
+ this.setRefreshToken(refreshTokens[0]);
136
+ this.getLoggedInAccounts();
132
137
  this.$emit('ssoLibraryReady');
133
138
  },
134
139
  ssoOutgoingEvent (data) {
@@ -151,6 +156,11 @@ export default {
151
156
  watch: {
152
157
  display () {
153
158
  this.applyBgStyle()
159
+ },
160
+ '$storageReady.value' (nv) {
161
+ if (nv) {
162
+ this.init()
163
+ }
154
164
  }
155
165
  }
156
166
  }
package/src/install.js CHANGED
@@ -4,9 +4,7 @@ import ReactiveStorage from '@tapni/capacitor-reactive-localstorage-vue3'
4
4
  // Export the component by default
5
5
  export default {
6
6
  TapniAuth: App,
7
- install: (app, options) => {
7
+ install: (app) => {
8
8
  app.component('TapniAuth', App);
9
-
10
- + app.use(ReactiveStorage, options);
11
9
  }
12
10
  };