@mundogamernetwork/shared-ui 1.1.55 → 1.1.58

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": "@mundogamernetwork/shared-ui",
3
- "version": "1.1.55",
3
+ "version": "1.1.58",
4
4
  "description": "Mundo Gamer Network - Shared UI Layer (Nuxt 3)",
5
5
  "type": "module",
6
6
  "main": "./nuxt.config.ts",
@@ -12,14 +12,31 @@ const SUPPORTED_LOCALES = ['en', 'pt-BR', 'es', 'de', 'ro', 'ar-AE'];
12
12
  const routePath = route.path.split('/');
13
13
  const lang = SUPPORTED_LOCALES.find(l => routePath.includes(l)) || 'en';
14
14
 
15
- const apiBase = (import.meta.env?.VITE_API_BASE_URL as string) || '';
16
-
17
- const { data: keyData, error: fetchError, pending } = await useAsyncData(
15
+ const config = useRuntimeConfig();
16
+ // keyApiUrl overrides apiBaseURL — lets each front point to a specific API base
17
+ // (e.g. community uses agency-api, not its own locale-prefixed API base).
18
+ // Follow the same override pattern as presskit/game/[slug].vue.
19
+ const cfg = (config.public as any)?.mgSharedUi || config.public;
20
+ const apiBase: string =
21
+ (config.public as any).keyApiUrl ||
22
+ cfg.keyApiUrl ||
23
+ (config.public.apiBaseURL as string) ||
24
+ '';
25
+
26
+ const { data: keyData, error: fetchError, pending, refresh } = await useAsyncData(
18
27
  `public-key-${slug}`,
19
28
  () => $fetch<any>(`${apiBase}/public/keys/${slug}`, { params: { lang } }),
20
- { lazy: false },
29
+ { lazy: false, server: !!apiBase },
21
30
  );
22
31
 
32
+ // If SSR produced no data (e.g. apiBase was empty during SSR), run a client-side
33
+ // fetch once mounted so the request appears in DevTools and the page can recover.
34
+ onMounted(async () => {
35
+ if (!keyData.value && !pending.value) {
36
+ await refresh();
37
+ }
38
+ });
39
+
23
40
  const key = computed(() => keyData.value?.data || null);
24
41
  const loading = pending;
25
42
  const error = computed(() => !!fetchError.value || (!pending.value && !key.value));