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:
@@ -199,6 +199,7 @@ ROLE_ADMIN → ROLE_GESTIONNAIRE → ROLE_VIEWER → ROLE_USER
|
|||||||
- **Composables** : `interface Deps { ... }` + `export function useXxx(deps: Deps)`
|
- **Composables** : `interface Deps { ... }` + `export function useXxx(deps: Deps)`
|
||||||
- **Communication composants** : Props + Events uniquement (pas de provide/inject)
|
- **Communication composants** : Props + Events uniquement (pas de provide/inject)
|
||||||
- **API** : `useApi.ts` wraps fetch avec `credentials: 'include'` pour les cookies session
|
- **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
|
- **Content-Type** : `application/ld+json` pour POST/PUT, `application/merge-patch+json` pour PATCH
|
||||||
- **Auth** : `useProfileSession` + middleware global `profile.global.ts`
|
- **Auth** : `useProfileSession` + middleware global `profile.global.ts`
|
||||||
- **Permissions** : `usePermissions.ts` miroir de la hiérarchie backend côté client
|
- **Permissions** : `usePermissions.ts` miroir de la hiérarchie backend côté client
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export function useCustomFieldNameSuggestions() {
|
|||||||
if (loading.value) return cache.value ?? []
|
if (loading.value) return cache.value ?? []
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
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)) {
|
if (response.success && Array.isArray(response.data)) {
|
||||||
cache.value = response.data
|
cache.value = response.data
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user