@mundogamernetwork/shared-ui 1.1.15 → 1.1.16
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.
|
@@ -17,7 +17,10 @@
|
|
|
17
17
|
*
|
|
18
18
|
* Props let a platform override the login base or disable dropdown positioning.
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
// buildLoginUrl and buildRegisterUrl are NOT imported explicitly here because
|
|
21
|
+
// this file ships as raw TypeScript inside an npm package. Relative imports of
|
|
22
|
+
// .ts files from node_modules fail in Vite production builds (vendor chunks are
|
|
23
|
+
// not transpiled). Instead, the URL logic is inlined directly.
|
|
21
24
|
|
|
22
25
|
const props = defineProps({
|
|
23
26
|
// Override the login URL entirely (else derived from apiBaseURL host).
|
|
@@ -47,14 +50,26 @@ const systemId =
|
|
|
47
50
|
import.meta.env.VITE_SYSTEM_ID ||
|
|
48
51
|
"";
|
|
49
52
|
|
|
53
|
+
// URL builders inlined to avoid relative .ts imports from node_modules.
|
|
54
|
+
function buildUrl(base: string, path: string, params: Record<string, string>) {
|
|
55
|
+
const p = new URLSearchParams(params);
|
|
56
|
+
return `${base}/${path}?${p}`;
|
|
57
|
+
}
|
|
58
|
+
|
|
50
59
|
// Computed at click time so redirect_to is always the CURRENT url.
|
|
51
60
|
function goLogin() {
|
|
52
61
|
if (typeof window === "undefined") return;
|
|
53
|
-
window.location.href
|
|
62
|
+
const redirectTo = window.location.href;
|
|
63
|
+
const params: Record<string, string> = { redirect_to: redirectTo };
|
|
64
|
+
if (systemId) params.system_id = systemId;
|
|
65
|
+
window.location.href = props.loginUrl || buildUrl(apiBase, "login", params);
|
|
54
66
|
}
|
|
55
67
|
function goRegister() {
|
|
56
68
|
if (typeof window === "undefined") return;
|
|
57
|
-
window.location.href
|
|
69
|
+
const redirectTo = window.location.href;
|
|
70
|
+
const params: Record<string, string> = { redirect_to: redirectTo };
|
|
71
|
+
if (systemId) params.system_id = systemId;
|
|
72
|
+
window.location.href = buildUrl(accountsBaseUrl, "register", params);
|
|
58
73
|
}
|
|
59
74
|
</script>
|
|
60
75
|
|