fix: select for languages
This commit is contained in:
@@ -29,15 +29,15 @@ export const useProductStore = defineStore('product', () => {
|
||||
const error = ref<string | null>(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<ProductDescription>(
|
||||
`/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 {
|
||||
|
||||
Reference in New Issue
Block a user