wip(frontend) : api calls + skeleton fetch
This commit is contained in:
@@ -30,7 +30,7 @@
|
|||||||
: 'text-base-content hover:bg-primary/10 hover:text-primary'
|
: 'text-base-content hover:bg-primary/10 hover:text-primary'
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
Vue d'ensemblee
|
Vue d'ensemble
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ export function useApi () {
|
|||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
...options,
|
...options,
|
||||||
|
headers: {
|
||||||
|
...defaultOptions.headers,
|
||||||
|
...options.headers
|
||||||
|
},
|
||||||
signal: controller.signal
|
signal: controller.signal
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -70,6 +74,9 @@ export function useApi () {
|
|||||||
const post = async (endpoint, data) => {
|
const post = async (endpoint, data) => {
|
||||||
return apiCall(endpoint, {
|
return apiCall(endpoint, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/ld+json'
|
||||||
|
},
|
||||||
body: JSON.stringify(data)
|
body: JSON.stringify(data)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -77,6 +84,9 @@ export function useApi () {
|
|||||||
const patch = async (endpoint, data) => {
|
const patch = async (endpoint, data) => {
|
||||||
return apiCall(endpoint, {
|
return apiCall(endpoint, {
|
||||||
method: 'PATCH',
|
method: 'PATCH',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/merge-patch+json'
|
||||||
|
},
|
||||||
body: JSON.stringify(data)
|
body: JSON.stringify(data)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3921,7 +3921,7 @@ const applyMachineLinks = (source) => {
|
|||||||
const loadMachineData = async () => {
|
const loadMachineData = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
const machineResult = await get(`/machines/${machineId}`)
|
const machineResult = await get(`/machines/${machineId}/skeleton`)
|
||||||
|
|
||||||
if (!machineResult.success) {
|
if (!machineResult.success) {
|
||||||
console.error('Machine non trouvée:', machineId, machineResult.error)
|
console.error('Machine non trouvée:', machineId, machineResult.error)
|
||||||
|
|||||||
@@ -187,6 +187,14 @@ onMounted(async () => {
|
|||||||
const typeId = route.params.id
|
const typeId = route.params.id
|
||||||
console.log('=== TYPE DETAIL PAGE LOADING ===')
|
console.log('=== TYPE DETAIL PAGE LOADING ===')
|
||||||
console.log('Loading type with ID:', typeId)
|
console.log('Loading type with ID:', typeId)
|
||||||
|
console.log('Full route params:', route.params)
|
||||||
|
|
||||||
|
if (!typeId) {
|
||||||
|
console.error('No type ID provided in route')
|
||||||
|
showError('Aucun identifiant de type fourni')
|
||||||
|
loading.value = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const result = await getMachineTypeById(typeId)
|
const result = await getMachineTypeById(typeId)
|
||||||
console.log('API Result:', result)
|
console.log('API Result:', result)
|
||||||
|
|||||||
@@ -60,7 +60,9 @@ export const uniqueConstructeurIds = (...sources: unknown[]): string[] => {
|
|||||||
if (value.constructeur) {
|
if (value.constructeur) {
|
||||||
explore(value.constructeur);
|
explore(value.constructeur);
|
||||||
}
|
}
|
||||||
if (typeof value.id === 'string') {
|
// Only extract ID if this looks like a constructeur object (has @type or recognizable fields)
|
||||||
|
// Don't extract ID from component/piece/product objects that happen to be passed in
|
||||||
|
if (typeof value.id === 'string' && !value.name && !value.typeComposant && !value.typePiece && !value.typeProduct) {
|
||||||
pushId(value.id);
|
pushId(value.id);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import tailwindcss from '@tailwindcss/vite'
|
import tailwindcss from '@tailwindcss/vite'
|
||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
compatibilityDate: '2025-07-15',
|
compatibilityDate: '2025-07-15',
|
||||||
|
ssr: false, // Désactive le SSR pour un mode SPA pur (Client-Side Rendering uniquement)
|
||||||
devtools: { enabled: true },
|
devtools: { enabled: true },
|
||||||
devServer: {
|
devServer: {
|
||||||
port: 3001
|
port: 3001
|
||||||
|
|||||||
Reference in New Issue
Block a user