fix: contedtable

This commit is contained in:
2026-03-13 13:56:42 +01:00
parent da165c1a98
commit baaa3efcdd
6 changed files with 108 additions and 23 deletions

View File

@@ -49,9 +49,7 @@ export const useProductStore = defineStore('product', () => {
currentProduct.value = null
try {
const data = await useFetchJson<{ items: Product }>(`/api/v1/restricted/product-description?id=${id}`, {
method: 'GET',
})
const data = await useFetchJson<{ items: Product }>(`/api/v1/restricted/product-description?id=${id}`)
const response = (data as any).items || data
currentProduct.value = response.items?.[0] || response
@@ -63,6 +61,34 @@ export const useProductStore = defineStore('product', () => {
}
}
async function saveProductDescription(description: string) {
try {
const data = await useFetchJson(
`/api/v1/restricted/product-description/save-product-description?productID=1&productShopID=1&productLangID=1`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
description: description,
description_short: "<p>Test short</p>",
meta_description: "This is a test",
meta_title: "...",
name: "...",
available_now: "Test",
available_later: "...",
usage: "<p>test</p>"
})
}
)
return data
} catch (e) {
console.error(e)
}
}
// Clear current product
function clearCurrentProduct() {
currentProduct.value = null
@@ -76,5 +102,6 @@ export const useProductStore = defineStore('product', () => {
getProductDescription,
fetchProductById,
clearCurrentProduct,
saveProductDescription
}
})