fix: save product descriptions

This commit is contained in:
2026-04-01 16:19:02 +02:00
parent d8f71bd8ff
commit 79730eb826
4 changed files with 82 additions and 68 deletions

View File

@@ -17,39 +17,39 @@ const cookie = useCookie()
// Initialize languages from API
export async function initLangs() {
try {
const { items } = await useFetchJson<Language[]>('/api/v1/langs')
langs.push(...items)
try {
const { items } = await useFetchJson<Language[]>('/api/v1/langs')
langs.push(...items)
let idfromcookie = null
const cc = cookie.getCookie('lang_id')
if (cc) {
idfromcookie = langs.find((x) => x.id == parseInt(cc))
}
defLang.value = items.find((x) => x.is_default == true)
currentLang.value = idfromcookie ?? defLang.value
} catch (error) {
console.error('Failed to fetch languages:', error)
let idfromcookie = null
const cc = cookie.getCookie('lang_id')
if (cc) {
idfromcookie = langs.find((x) => x.id == parseInt(cc))
}
defLang.value = items.find((x) => x.is_default == true)
currentLang.value = idfromcookie ?? defLang.value
} catch (error) {
console.error('Failed to fetch languages:', error)
}
}
// Initialize country/currency from API
export async function initCountryCurrency() {
try {
const { items } = await useFetchJson<Country[]>('/api/v1/restricted/langs-and-countries/get-countries')
countries.push(...items)
try {
const { items } = await useFetchJson<Country[]>('/api/v1/restricted/langs-and-countries/get-countries')
countries.push(...items)
let idfromcookie = null
const cc = cookie.getCookie('country_id')
if (cc) {
idfromcookie = langs.find((x) => x.id == parseInt(cc))
}
defCountry.value = items.find((x) => x.id === defLang.value?.id)
currentCountry.value = idfromcookie ?? defCountry.value
} catch (error) {
console.error('Failed to fetch languages:', error)
let idfromcookie = null
const cc = cookie.getCookie('country_id')
if (cc) {
idfromcookie = langs.find((x) => x.id == parseInt(cc))
}
defCountry.value = items.find((x) => x.id === defLang.value?.id)
currentCountry.value = idfromcookie ?? defCountry.value
} catch (error) {
console.error('Failed to fetch languages:', error)
}
}
export async function switchLocalization() {