@lenne.tech/nuxt-extensions 1.5.0 → 1.5.1

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.
@@ -39,7 +39,7 @@ export function getOrCreateLtAuthClient(config) {
39
39
  }
40
40
  export function createLtAuthClient(config = {}) {
41
41
  const useProxy = isLocalDevApiProxy();
42
- const defaultBaseURL = useProxy ? "" : import.meta.env?.VITE_API_URL || process.env.API_URL || "http://localhost:3000";
42
+ const defaultBaseURL = useProxy ? "" : import.meta.env?.VITE_API_URL || process.env.API_URL || "";
43
43
  const defaultBasePath = useProxy ? "/api/iam" : "/iam";
44
44
  const {
45
45
  baseURL = defaultBaseURL,
@@ -56,7 +56,7 @@ export declare function isLocalDevApiProxy(): boolean;
56
56
  * keys at build time so Nuxt knows which keys to override.
57
57
  *
58
58
  * ### SSR (Server-Side Rendering)
59
- * Fallback chain: `NUXT_API_URL` → `NUXT_PUBLIC_API_URL` → `auth.baseURL` → `localhost:3000`
59
+ * Fallback chain: `NUXT_API_URL` → `NUXT_PUBLIC_API_URL` → `auth.baseURL` → `""` (warns)
60
60
  *
61
61
  * `NUXT_API_URL` allows using an internal network address (e.g., `http://api.svc.cluster.local`)
62
62
  * that is never exposed to the client bundle. If not set, the public URL is used.
@@ -66,7 +66,7 @@ export declare function isLocalDevApiProxy(): boolean;
66
66
  * This ensures same-origin requests for cookies/WebAuthn. **Only for local development.**
67
67
  *
68
68
  * ### Client direct (deployed instances)
69
- * Fallback chain: `NUXT_PUBLIC_API_URL` → `auth.baseURL` → `localhost:3000`
69
+ * Fallback chain: `NUXT_PUBLIC_API_URL` → `auth.baseURL` → `""` (warns)
70
70
  *
71
71
  * ## Deployment Scenarios
72
72
  *
@@ -31,16 +31,24 @@ export function buildLtApiUrl(path) {
31
31
  const publicUrl = runtimeConfig.public.apiUrl || "";
32
32
  const authBaseURL = runtimeConfig.public?.ltExtensions?.auth?.baseURL || "";
33
33
  if (import.meta.server) {
34
- const apiUrl2 = runtimeConfig.apiUrl || publicUrl || authBaseURL || "http://localhost:3000";
35
- return `${apiUrl2.replace(/\/+$/, "")}${path}`;
34
+ const apiUrl2 = runtimeConfig.apiUrl || publicUrl || authBaseURL;
35
+ if (!apiUrl2) {
36
+ console.warn(
37
+ "[LtExtensions] No API URL configured. Set NUXT_API_URL or NUXT_PUBLIC_API_URL."
38
+ );
39
+ }
40
+ return `${(apiUrl2 || "").replace(/\/+$/, "")}${path}`;
36
41
  }
37
42
  if (isLocalDevApiProxy()) {
38
43
  return `/api${path}`;
39
44
  }
40
- const apiUrl = publicUrl || authBaseURL || "http://localhost:3000";
41
- return `${apiUrl.replace(/\/+$/, "")}${path}`;
45
+ const apiUrl = publicUrl || authBaseURL;
46
+ if (!apiUrl) {
47
+ console.warn("[LtExtensions] No API URL configured. Set NUXT_PUBLIC_API_URL.");
48
+ }
49
+ return `${(apiUrl || "").replace(/\/+$/, "")}${path}`;
42
50
  } catch {
43
- return `http://localhost:3000${path}`;
51
+ return path;
44
52
  }
45
53
  }
46
54
  export function getLtAuthMode() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lenne.tech/nuxt-extensions",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "Reusable Nuxt 4 composables, components, and Better-Auth integration for lenne.tech projects",
5
5
  "repository": {
6
6
  "type": "git",