@mundogamernetwork/shared-ui 1.1.54 → 1.1.57

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.54",
3
+ "version": "1.1.57",
4
4
  "description": "Mundo Gamer Network - Shared UI Layer (Nuxt 3)",
5
5
  "type": "module",
6
6
  "main": "./nuxt.config.ts",
@@ -3,8 +3,6 @@
3
3
  // (Discord/Telegram/WhatsApp) and from anywhere — no need to enter a dashboard.
4
4
  // Anyone can view; requesting a key uses KeyBrowser's hybrid auth (it redirects
5
5
  // to login on 401 and returns).
6
- import httpService from '../services/httpService';
7
-
8
6
  definePageMeta({ layout: 'blank' });
9
7
 
10
8
  const route = useRoute();
@@ -14,12 +12,25 @@ const SUPPORTED_LOCALES = ['en', 'pt-BR', 'es', 'de', 'ro', 'ar-AE'];
14
12
  const routePath = route.path.split('/');
15
13
  const lang = SUPPORTED_LOCALES.find(l => routePath.includes(l)) || 'en';
16
14
 
17
- const { data: keyData, error: fetchError, pending } = await useAsyncData(
15
+ const config = useRuntimeConfig();
16
+ // apiBaseURL may be undefined at build time on some deployments — fall back to
17
+ // a relative path so the SSR node process at least resolves against the same host.
18
+ const apiBase = (config.public.apiBaseURL as string) || '';
19
+
20
+ const { data: keyData, error: fetchError, pending, refresh } = await useAsyncData(
18
21
  `public-key-${slug}`,
19
- () => httpService.get<any>(`/public/keys/${slug}`, { params: { lang } }).then(r => r.data),
20
- { lazy: false },
22
+ () => $fetch<any>(`${apiBase}/public/keys/${slug}`, { params: { lang } }),
23
+ { lazy: false, server: !!apiBase },
21
24
  );
22
25
 
26
+ // If SSR produced no data (e.g. apiBase was empty during SSR), run a client-side
27
+ // fetch once mounted so the request appears in DevTools and the page can recover.
28
+ onMounted(async () => {
29
+ if (!keyData.value && !pending.value) {
30
+ await refresh();
31
+ }
32
+ });
33
+
23
34
  const key = computed(() => keyData.value?.data || null);
24
35
  const loading = pending;
25
36
  const error = computed(() => !!fetchError.value || (!pending.value && !key.value));