@geexcode/geex-angular 0.0.32 → 0.0.33

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/dist/index.js CHANGED
@@ -165,14 +165,21 @@ function createTenantModule(injector) {
165
165
  }
166
166
  function createAuthModule(injector) {
167
167
  const user = (0, import_core.signal)(null);
168
+ let _initPromise = null;
168
169
  const module2 = {
169
- init: async () => {
170
- try {
171
- let userData = await module2.loadUserData();
172
- user.set(userData ?? null);
173
- } catch (err) {
174
- console.error(err);
170
+ init: () => {
171
+ if (_initPromise) {
172
+ return _initPromise;
175
173
  }
174
+ _initPromise = (async () => {
175
+ try {
176
+ const userData = await module2.loadUserData();
177
+ user.set(userData ?? null);
178
+ } catch (err) {
179
+ console.error(err);
180
+ }
181
+ })();
182
+ return _initPromise;
176
183
  },
177
184
  user,
178
185
  async loadUserData() {
@@ -238,6 +245,7 @@ function createMessagingModule(injector) {
238
245
  const module2 = {
239
246
  async init() {
240
247
  try {
248
+ await geex.auth.init();
241
249
  if (injector.get(import_angular_oauth2_oidc.OAuthService).hasValidAccessToken()) {
242
250
  const subClient = injector.get(import_apollo_angular.Apollo).use("subscription");
243
251
  subClient.subscribe({ query: GQL_ON_PUBLIC_NOTIFY }).pipe((0, import_rxjs.map)((res) => res?.data?.onPublicNotify)).subscribe((notify) => {
package/dist/index.mjs CHANGED
@@ -119,14 +119,21 @@ function createTenantModule(injector) {
119
119
  }
120
120
  function createAuthModule(injector) {
121
121
  const user = signal(null);
122
+ let _initPromise = null;
122
123
  const module = {
123
- init: async () => {
124
- try {
125
- let userData = await module.loadUserData();
126
- user.set(userData ?? null);
127
- } catch (err) {
128
- console.error(err);
124
+ init: () => {
125
+ if (_initPromise) {
126
+ return _initPromise;
129
127
  }
128
+ _initPromise = (async () => {
129
+ try {
130
+ const userData = await module.loadUserData();
131
+ user.set(userData ?? null);
132
+ } catch (err) {
133
+ console.error(err);
134
+ }
135
+ })();
136
+ return _initPromise;
130
137
  },
131
138
  user,
132
139
  async loadUserData() {
@@ -192,6 +199,7 @@ function createMessagingModule(injector) {
192
199
  const module = {
193
200
  async init() {
194
201
  try {
202
+ await geex.auth.init();
195
203
  if (injector.get(OAuthService).hasValidAccessToken()) {
196
204
  const subClient = injector.get(Apollo).use("subscription");
197
205
  subClient.subscribe({ query: GQL_ON_PUBLIC_NOTIFY }).pipe(map((res) => res?.data?.onPublicNotify)).subscribe((notify) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geexcode/geex-angular",
3
- "version": "0.0.32",
3
+ "version": "0.0.33",
4
4
  "description": "Angular adapter for Geex core.",
5
5
  "module": "dist/index.js",
6
6
  "main": "dist/index.cjs",