changes
This commit is contained in:
@@ -24,12 +24,13 @@ export class ApiService {
|
||||
return map[apiLang] || apiLang.toLowerCase();
|
||||
}
|
||||
|
||||
/** Resolve relative image URLs (e.g. ./images/x.webp) against API base */
|
||||
/** Resolve relative image URLs (e.g. ./images/x.webp) against site origin */
|
||||
private resolveImageUrl(url: string): string {
|
||||
if (!url) return '';
|
||||
if (url.startsWith('http://') || url.startsWith('https://') || url.startsWith('/')) return url;
|
||||
if (url.startsWith('./')) return `${this.baseUrl}/${url.slice(2)}`;
|
||||
return `${this.baseUrl}/${url}`;
|
||||
const origin = `https://${environment.domain}`;
|
||||
if (url.startsWith('./')) return `${origin}/${url.slice(2)}`;
|
||||
return `${origin}/${url}`;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,17 +107,6 @@ export class ApiService {
|
||||
}
|
||||
}
|
||||
|
||||
// Map backend descriptions[] → translations (multi-lang descriptions)
|
||||
if (raw.descriptions && Array.isArray(raw.descriptions)) {
|
||||
item.descriptions = raw.descriptions;
|
||||
if (!item.translations) item.translations = {};
|
||||
for (const entry of raw.descriptions) {
|
||||
const lang = this.normalizeLang(entry.language);
|
||||
if (!item.translations[lang]) item.translations[lang] = {};
|
||||
item.translations[lang].simpleDescription = entry.value;
|
||||
}
|
||||
}
|
||||
|
||||
// Preserve attributes from backend
|
||||
item.attributes = raw.attributes || [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user