Merge remote-tracking branch 'origin/main' into front-styles

This commit is contained in:
2026-04-03 13:10:05 +02:00
9 changed files with 264 additions and 245 deletions

View File

@@ -28,6 +28,7 @@ export const useProductStore = defineStore('product', () => {
const loading = ref(false)
const error = ref<string | null>(null)
const productDescription = ref()
const copyProductDescription = ref()
async function getProductDescription(langId: number | null, productID: number) {
loading.value = true
@@ -36,8 +37,8 @@ export const useProductStore = defineStore('product', () => {
const response = await useFetchJson<ProductDescription>(
`/api/v1/restricted/product-translation/get-product-description?productID=${productID}&productLangID=${langId ? langId : settingStore.shopDefaultLanguage}`
)
productDescription.value = response.items
productDescription.value = structuredClone(response.items)
copyProductDescription.value = structuredClone(response.items)
} catch (e: unknown) {
error.value = e instanceof Error ? e.message : 'Failed to load product description'
} finally {
@@ -45,7 +46,6 @@ export const useProductStore = defineStore('product', () => {
}
}
const translat = ref()
const settingStore = useSettingsStore()
async function translateProductDescription(productID: number, toLangId: number, model: string = 'Google') {
loading.value = true
@@ -87,6 +87,8 @@ export const useProductStore = defineStore('product', () => {
})
}
)
await getProductDescription(langId, productID)
return data
} catch (e) {
console.error(e)
@@ -97,7 +99,7 @@ export const useProductStore = defineStore('product', () => {
productDescription,
loading,
error,
translat,
copyProductDescription,
translateProductDescription,
getProductDescription,
saveProductDescription