fix(custom-fields) : retire le prefixe /api en double dans l'appel API

useApi() prepend deja apiBaseUrl (= /api), donc l'appel doit etre
/custom-fields/names et non /api/custom-fields/names (sinon 404 sur
/api/api/custom-fields/names).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matthieu
2026-05-11 15:26:46 +02:00
parent 17ca857cc3
commit 5244698384
2 changed files with 2 additions and 1 deletions

View File

@@ -199,6 +199,7 @@ ROLE_ADMIN → ROLE_GESTIONNAIRE → ROLE_VIEWER → ROLE_USER
- **Composables** : `interface Deps { ... }` + `export function useXxx(deps: Deps)`
- **Communication composants** : Props + Events uniquement (pas de provide/inject)
- **API** : `useApi.ts` wraps fetch avec `credentials: 'include'` pour les cookies session
- **⚠️ Préfixe `/api`** : `useApi()` **prepend déjà** `apiBaseUrl` (= `/api` par défaut, cf. `nuxt.config.ts`). Les appels doivent donc utiliser des chemins **sans** `/api` au début. Ex : `api.get('/custom-fields/names')` et **PAS** `api.get('/api/custom-fields/names')` (sinon 404 sur `/api/api/...`).
- **Content-Type** : `application/ld+json` pour POST/PUT, `application/merge-patch+json` pour PATCH
- **Auth** : `useProfileSession` + middleware global `profile.global.ts`
- **Permissions** : `usePermissions.ts` miroir de la hiérarchie backend côté client

View File

@@ -11,7 +11,7 @@ export function useCustomFieldNameSuggestions() {
if (loading.value) return cache.value ?? []
loading.value = true
try {
const response = await api.get<string[]>('/api/custom-fields/names')
const response = await api.get<string[]>('/custom-fields/names')
if (response.success && Array.isArray(response.data)) {
cache.value = response.data
}