diff --git a/bo/components.d.ts b/bo/components.d.ts
index aabe3f5..7c39661 100644
--- a/bo/components.d.ts
+++ b/bo/components.d.ts
@@ -40,6 +40,7 @@ declare module 'vue' {
TopBar: typeof import('./src/components/TopBar.vue')['default']
TopBarLogin: typeof import('./src/components/TopBarLogin.vue')['default']
UAlert: typeof import('./node_modules/@nuxt/ui/dist/runtime/components/Alert.vue')['default']
+ UAvatar: typeof import('./node_modules/@nuxt/ui/dist/runtime/components/Avatar.vue')['default']
UButton: typeof import('./node_modules/@nuxt/ui/dist/runtime/components/Button.vue')['default']
UCard: typeof import('./node_modules/@nuxt/ui/dist/runtime/components/Card.vue')['default']
UCheckbox: typeof import('./node_modules/@nuxt/ui/dist/runtime/components/Checkbox.vue')['default']
diff --git a/bo/src/components/admin/ProductDetailView.vue b/bo/src/components/admin/ProductDetailView.vue
index 2efe361..7dd650a 100644
--- a/bo/src/components/admin/ProductDetailView.vue
+++ b/bo/src/components/admin/ProductDetailView.vue
@@ -5,30 +5,19 @@
-
Translate from Polish to
-
-
-
-
- Select language
-
-
- {{availableLangs.find(x => x.id === modelValue)?.flag}}
-
- {{availableLangs.find(x => x.id === modelValue)?.name}}
-
-
-
+ Translate from Polish to
+
+
+ {{ modelValue }}
-
-
-
-
{{ item.flag }}
-
{{ item.name }}
+
+
+ {{ item.flag }}
+ {{ item.name }}
-
-
-
-
@@ -195,7 +181,7 @@ const settingStore = useSettingsStore()
const productStore = useProductStore()
const isTranslations = ref(false)
-const toLangId = ref(settingStore.shopDefaultLanguage)
+const toLangId = ref(null)
const availableLangs = computed(() => langs.filter(item => item.id !== settingStore.shopDefaultLanguage))
const productID = ref(0)
@@ -224,8 +210,8 @@ const translateToSelectedLanguage = async () => {
}
}
-const fetchForLanguage = async (langId: number) => {
- if (langId && productID.value) {
+const fetchForLanguage = async (langId: number | null) => {
+ if (productID.value) {
await productStore.getProductDescription(langId, productID.value)
}
}
diff --git a/bo/src/stores/product.ts b/bo/src/stores/product.ts
index 2283b4b..a400bd2 100644
--- a/bo/src/stores/product.ts
+++ b/bo/src/stores/product.ts
@@ -29,15 +29,15 @@ export const useProductStore = defineStore('product', () => {
const error = ref(null)
const productDescription = ref()
- async function getProductDescription(langId: number, productID: number) {
+ async function getProductDescription(langId: number | null, productID: number) {
loading.value = true
error.value = null
try {
const response = await useFetchJson(
- `/api/v1/restricted/product-translation/get-product-description?productID=${productID}&productLangID=${langId}`
+ `/api/v1/restricted/product-translation/get-product-description?productID=${productID}&productLangID=${langId ? langId : settingStore.shopDefaultLanguage}`
)
productDescription.value = response.items
-
+
} catch (e: unknown) {
error.value = e instanceof Error ? e.message : 'Failed to load product description'
} finally {