feat: enhance language support in data fetching across components

- Updated Content, ProductDetailPage, and GrowTentKonfigurator to include current language context when emitting WebSocket requests for product and category data.
- Improved caching logic to ensure fresh data loading based on language changes.
- Enhanced localization by adding language parameters to data requests, improving user experience across different languages.
This commit is contained in:
sebseb7
2025-08-09 10:06:43 +02:00
parent d40e311b51
commit 2ac9baada0
3 changed files with 16 additions and 14 deletions

View File

@@ -282,7 +282,10 @@ class Content extends Component {
}
});
window.socketManager.emit("getCategoryProducts", { categoryId: categoryId },
const currentLanguage = this.props.languageContext?.currentLanguage || this.props.i18n?.language || 'de';
window.socketManager.emit(
"getCategoryProducts",
{ categoryId: categoryId, language: currentLanguage, requestTranslation: currentLanguage === 'de' ? false : true },
(response) => {
console.log("getCategoryProducts stub response", response);
// Only process stub response if we haven't received the full response yet
@@ -348,7 +351,10 @@ class Content extends Component {
}
fetchSearchData(query) {
window.socketManager.emit("getSearchProducts", { query },
const currentLanguage = this.props.languageContext?.currentLanguage || this.props.i18n?.language || 'de';
window.socketManager.emit(
"getSearchProducts",
{ query, language: currentLanguage, requestTranslation: currentLanguage === 'de' ? false : true },
(response) => {
if (response && response.products) {
this.processData(response);