@innertia-solutions/innertia-nuxt 0.1.60 → 0.1.61

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": "@innertia-solutions/innertia-nuxt",
3
- "version": "0.1.60",
3
+ "version": "0.1.61",
4
4
  "description": "Innertia Solutions — Nuxt layer unificada: core, auth, multitenancy, theme y app contexts",
5
5
  "keywords": [
6
6
  "nuxt",
@@ -11,7 +11,7 @@ export default defineEventHandler(async (event) => {
11
11
  const context = (query.context as string) || 'backoffice'
12
12
  let data: any
13
13
  try {
14
- data = await $fetch(`${config.apiInternalUrl}/api/auth/${provider}/callback`, {
14
+ data = await $fetch(`${config.apiInternalUrl}/auth/${provider}/callback`, {
15
15
  method: 'GET', query, headers: { Accept: 'application/json' },
16
16
  })
17
17
  } catch (err: any) {
@@ -10,7 +10,7 @@ export default defineEventHandler(async (event) => {
10
10
  const config = useRuntimeConfig(event)
11
11
  let data: any
12
12
  try {
13
- data = await $fetch(`${config.apiInternalUrl}/api/auth/login`, {
13
+ data = await $fetch(`${config.apiInternalUrl}/auth/login`, {
14
14
  method: 'POST',
15
15
  body: { context, email, password, remember },
16
16
  headers: { Accept: 'application/json' },
@@ -8,7 +8,7 @@ export default defineEventHandler(async (event) => {
8
8
  const { token } = await readSession(event)
9
9
  if (token) {
10
10
  try {
11
- await $fetch(`${config.apiInternalUrl}/api/auth/logout`, {
11
+ await $fetch(`${config.apiInternalUrl}/auth/logout`, {
12
12
  method: 'POST', headers: { ...buildAuthHeaders(token), Accept: 'application/json' },
13
13
  })
14
14
  } catch { /* best-effort */ }
@@ -2,13 +2,13 @@ import { describe, it, expect } from 'vitest'
2
2
  import { resolveApiTarget, buildAuthHeaders } from '../bff'
3
3
 
4
4
  describe('resolveApiTarget', () => {
5
- it('arma base + /api/ + path + querystring', () => {
6
- expect(resolveApiTarget('http://api:80', 'auth/me', '')).toBe('http://api:80/api/auth/me')
5
+ it('arma base + path + querystring (Laravel sirve en root, sin /api)', () => {
6
+ expect(resolveApiTarget('http://api:80', 'auth/me', '')).toBe('http://api:80/auth/me')
7
7
  expect(resolveApiTarget('http://api:80', 'question-bank', '?perPage=1'))
8
- .toBe('http://api:80/api/question-bank?perPage=1')
8
+ .toBe('http://api:80/question-bank?perPage=1')
9
9
  })
10
10
  it('normaliza slashes duplicados en la base', () => {
11
- expect(resolveApiTarget('http://api:80/', 'auth/me', '')).toBe('http://api:80/api/auth/me')
11
+ expect(resolveApiTarget('http://api:80/', 'auth/me', '')).toBe('http://api:80/auth/me')
12
12
  })
13
13
  })
14
14
 
@@ -1,9 +1,13 @@
1
1
  // Lógica pura del BFF. Sin dependencias de h3 para poder testear aislado.
2
2
 
3
- /** Construye la URL destino en Laravel: base + /api/ + path + query. */
3
+ /**
4
+ * Construye la URL destino en Laravel: base + path + query.
5
+ * El prefijo `/api` del front es solo el punto de montaje del BFF; Laravel sirve
6
+ * en root (el proxy viejo `/api/** → http://api:80/**` también stripeaba el /api).
7
+ */
4
8
  export function resolveApiTarget(base: string, path: string, search: string): string {
5
9
  const cleanBase = base.replace(/\/+$/, '')
6
- return `${cleanBase}/api/${path}${search}`
10
+ return `${cleanBase}/${path}${search}`
7
11
  }
8
12
 
9
13
  /**