@innertia-solutions/innertia-nuxt 0.1.17 → 0.1.19

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/app.config.ts CHANGED
@@ -17,8 +17,15 @@ export default defineAppConfig({
17
17
  * Default por compatibilidad con productos existentes.
18
18
  * - 'app' → single-tenant / app interna. No detecta subdomain ni inyecta tenant header.
19
19
  * Auth y contextos siguen funcionando igual que en saas.
20
+ *
21
+ * IMPORTANTE: se deja `undefined` a propósito (no hardcodear 'saas' aquí).
22
+ * Nuxt mergea `app.config.ts` de la capa CON MAYOR prioridad que el bloque
23
+ * `appConfig` del `nuxt.config.ts` del producto (defuFn(cfg_capa, inlineConfig)).
24
+ * Si pusiéramos un valor concreto, el producto no podría cambiarlo desde su
25
+ * nuxt.config. Con `undefined`, defu deja pasar el valor del producto y el
26
+ * default real ('saas') lo aplica `useInnertiaMode()` vía `?? 'saas'`.
20
27
  */
21
- mode: 'saas' as InnertiaMode,
28
+ mode: undefined as InnertiaMode | undefined,
22
29
 
23
30
  /**
24
31
  * Branding del producto (nombre + versión). Los logos viven en `/public/isologo-light.png`
@@ -14,7 +14,8 @@ export function useAuth() {
14
14
  */
15
15
  async function performLogin(context, email, password, remember = false) {
16
16
  authStore.rememberUser = remember
17
- const data = await api.post(`${context}/auth/login`, { email, password, context })
17
+ // Endpoint agnóstico de contexto: el contexto viaja en el payload (y luego en el JWT).
18
+ const data = await api.post('auth/login', { email, password, context })
18
19
  authStore.saveToken(data.token ?? data.access_token)
19
20
  authStore.setCurrentContext(context)
20
21
  queryClient.clear()
@@ -75,7 +76,9 @@ export function useAuth() {
75
76
  * Returns the URL string from the backend.
76
77
  */
77
78
  async function getOauthRedirectUrl(context, provider) {
78
- const data = await api.get(`${context}/auth/oauth/${provider}/redirect`)
79
+ // Endpoint agnóstico: el contexto viaja como query param (el backend lo
80
+ // codifica en el state de OAuth y lo recupera en el callback).
81
+ const data = await api.get(`auth/${provider}/redirect`, { params: { context } })
79
82
  return data.url
80
83
  }
81
84
 
@@ -83,7 +86,7 @@ export function useAuth() {
83
86
  * Handle OAuth callback. Same success path as performLogin.
84
87
  */
85
88
  async function handleOauthCallback(context, provider, code) {
86
- const data = await api.post(`${context}/auth/oauth/${provider}/callback`, { code })
89
+ const data = await api.post(`auth/${provider}/callback`, { code, context })
87
90
  authStore.saveToken(data.token ?? data.access_token)
88
91
  authStore.setCurrentContext(context)
89
92
  queryClient.clear()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@innertia-solutions/innertia-nuxt",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "description": "Innertia Solutions — Nuxt layer unificada: core, auth, multitenancy, theme y app contexts",
5
5
  "keywords": [
6
6
  "nuxt",