fix : resolve runtime errors and improve configuration
- Add explicit imports for useClientService/useProjectService (not auto-imported from services/) - Fix AppDrawer v-if placement on Teleport to avoid slot warning - Add json format support in API Platform config (415 fix) - Support both hydra:member and member keys in extractHydraMembers - Add Vite/Nitro dev proxy for API calls - Update CLAUDE.md with full project documentation - Use tertiary-500 background for project cards Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,11 @@
|
|||||||
api_platform:
|
api_platform:
|
||||||
title: Hello API Platform
|
title: Hello API Platform
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
|
formats:
|
||||||
|
jsonld: ['application/ld+json']
|
||||||
|
json: ['application/json']
|
||||||
|
patch_formats:
|
||||||
|
json: ['application/merge-patch+json']
|
||||||
defaults:
|
defaults:
|
||||||
stateless: true
|
stateless: true
|
||||||
cache_headers:
|
cache_headers:
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<Teleport to="body">
|
<Teleport v-if="modelValue" to="body">
|
||||||
<Transition name="drawer">
|
<Transition name="drawer" appear>
|
||||||
<div
|
<div
|
||||||
v-if="modelValue"
|
|
||||||
class="fixed inset-0 z-40 flex justify-end"
|
class="fixed inset-0 z-40 flex justify-end"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -49,6 +49,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Client, ClientWrite } from '~/services/dto/client'
|
import type { Client, ClientWrite } from '~/services/dto/client'
|
||||||
|
import { useClientService } from '~/services/clients'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
modelValue: boolean
|
modelValue: boolean
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Project, ProjectWrite } from '~/services/dto/project'
|
import type { Project, ProjectWrite } from '~/services/dto/project'
|
||||||
import type { Client } from '~/services/dto/client'
|
import type { Client } from '~/services/dto/client'
|
||||||
|
import { useProjectService } from '~/services/projects'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
modelValue: boolean
|
modelValue: boolean
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export type ApiFetchOptions<ResponseType extends 'json' | 'blob'> =
|
|||||||
|
|
||||||
export const useApi = (): ApiClient => {
|
export const useApi = (): ApiClient => {
|
||||||
const config = useRuntimeConfig()
|
const config = useRuntimeConfig()
|
||||||
const baseURL = config.public.apiBase ?? '/api'
|
const baseURL = config.public.apiBase || '/api'
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
const auth = useAuthStore()
|
const auth = useAuthStore()
|
||||||
const nuxtApp = useNuxtApp()
|
const nuxtApp = useNuxtApp()
|
||||||
|
|||||||
@@ -17,10 +17,30 @@ export default defineNuxtConfig({
|
|||||||
],
|
],
|
||||||
runtimeConfig: {
|
runtimeConfig: {
|
||||||
public: {
|
public: {
|
||||||
apiBase: process.env.NUXT_PUBLIC_API_BASE
|
apiBase: process.env.NUXT_PUBLIC_API_BASE || '/api'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
devServer: {port: 3002},
|
devServer: {
|
||||||
|
port: 3002,
|
||||||
|
},
|
||||||
|
nitro: {
|
||||||
|
devProxy: {
|
||||||
|
'/api': {
|
||||||
|
target: 'http://nginx',
|
||||||
|
changeOrigin: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
vite: {
|
||||||
|
server: {
|
||||||
|
proxy: {
|
||||||
|
'/api': {
|
||||||
|
target: 'http://nginx',
|
||||||
|
changeOrigin: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
toast: {
|
toast: {
|
||||||
settings: {
|
settings: {
|
||||||
timeout: 2000,
|
timeout: 2000,
|
||||||
|
|||||||
@@ -51,6 +51,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Client } from '~/services/dto/client'
|
import type { Client } from '~/services/dto/client'
|
||||||
|
import { useClientService } from '~/services/clients'
|
||||||
|
|
||||||
useHead({ title: 'Clients' })
|
useHead({ title: 'Clients' })
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<div
|
<div
|
||||||
v-for="project in projects"
|
v-for="project in projects"
|
||||||
:key="project.id"
|
:key="project.id"
|
||||||
class="cursor-pointer rounded-lg border border-neutral-200 bg-white shadow-sm transition hover:shadow-md"
|
class="cursor-pointer rounded-lg border border-neutral-200 bg-tertiary-500 shadow-sm transition hover:shadow-md"
|
||||||
@click="openEdit(project)"
|
@click="openEdit(project)"
|
||||||
>
|
>
|
||||||
<div class="h-2 rounded-t-lg" :style="{ backgroundColor: project.color }" />
|
<div class="h-2 rounded-t-lg" :style="{ backgroundColor: project.color }" />
|
||||||
@@ -46,6 +46,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Project } from '~/services/dto/project'
|
import type { Project } from '~/services/dto/project'
|
||||||
import type { Client } from '~/services/dto/client'
|
import type { Client } from '~/services/dto/client'
|
||||||
|
import { useProjectService } from '~/services/projects'
|
||||||
|
import { useClientService } from '~/services/clients'
|
||||||
|
|
||||||
useHead({ title: 'Projets' })
|
useHead({ title: 'Projets' })
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
export type HydraCollection<T> = {
|
export type HydraCollection<T> = {
|
||||||
'hydra:member': T[]
|
'hydra:member'?: T[]
|
||||||
'hydra:totalItems': number
|
'hydra:totalItems'?: number
|
||||||
|
'member'?: T[]
|
||||||
|
'totalItems'?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export function extractHydraMembers<T>(response: HydraCollection<T>): T[] {
|
export function extractHydraMembers<T>(response: HydraCollection<T>): T[] {
|
||||||
return response['hydra:member'] ?? []
|
return response['hydra:member'] ?? response['member'] ?? []
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user