feat: enhance ProductDetailPage with language context support for product view requests
- Updated the ProductDetailPage to include the current language context when emitting product view requests via WebSocket. - Added logic to determine the appropriate language setting, improving localization and user experience. - Enhanced debugging output for better tracking of language-related issues.
This commit is contained in:
@@ -294,9 +294,12 @@ class ProductDetailPage extends Component {
|
||||
}));
|
||||
|
||||
console.log('loadKomponent', id, count);
|
||||
const currentLanguage = this.props.languageContext?.currentLanguage
|
||||
const currentLanguage2 = this.props.i18n?.language || 'de';
|
||||
console.log('debuglanguage', currentLanguage, currentLanguage2);
|
||||
window.socketManager.emit(
|
||||
"getProductView",
|
||||
{ articleId: id },
|
||||
{ articleId: id, language: currentLanguage, requestTranslation: currentLanguage === "de" ? false : true},
|
||||
(res) => {
|
||||
if (res.success) {
|
||||
// Cache the successful response
|
||||
@@ -406,9 +409,11 @@ class ProductDetailPage extends Component {
|
||||
|
||||
loadProductData = () => {
|
||||
console.log('loadProductData', this.props.seoName);
|
||||
const currentLanguage = this.props.languageContext?.currentLanguage || this.props.i18n?.language || 'de';
|
||||
console.log('debuglanguage', currentLanguage);
|
||||
window.socketManager.emit(
|
||||
"getProductView",
|
||||
{ seoName: this.props.seoName },
|
||||
{ seoName: this.props.seoName, language: currentLanguage, requestTranslation: currentLanguage === "de" ? false : true},
|
||||
(res) => {
|
||||
if (res.success) {
|
||||
res.product.seoName = this.props.seoName;
|
||||
|
||||
Reference in New Issue
Block a user