@mundogamernetwork/shared-ui 1.1.43 → 1.1.44
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
|
@@ -10,8 +10,17 @@ interface SerializeObject {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
const getNetworkBaseUrl = () => {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
// useRuntimeConfig() needs the active Nuxt instance and throws when called
|
|
14
|
+
// outside a setup context — these service functions run from async Pinia
|
|
15
|
+
// actions (loadPreviewData -> store -> service), where on SSR the context
|
|
16
|
+
// is already gone. Fall back to the build-time env so the fetch still works.
|
|
17
|
+
try {
|
|
18
|
+
const fromConfig = useRuntimeConfig().public.mgSharedUi?.networkBaseUrl;
|
|
19
|
+
if (fromConfig) return fromConfig as string;
|
|
20
|
+
} catch (_) {
|
|
21
|
+
// outside Nuxt context — use the env fallback below
|
|
22
|
+
}
|
|
23
|
+
return import.meta.env.VITE_BASE_URL_NETWORK;
|
|
15
24
|
};
|
|
16
25
|
|
|
17
26
|
export const complexSerialize = function (obj: SerializeObject): string {
|