refactor: enhance SharedCarousel to support language context updates and improve category fetching logic

This commit is contained in:
sebseb7
2025-07-31 04:50:55 +02:00
parent b29b946aaf
commit 9b38ed6f2a
2 changed files with 30 additions and 5 deletions

View File

@@ -29,9 +29,16 @@ class CategoryService {
}
return new Promise((resolve) => {
window.socketManager.emit("categoryList", {categoryId: categoryId, language: language}, (response) => {
window.socketManager.emit("categoryList", {categoryId: categoryId, language: language, requestTranslation: language === "de" ? false : true}, (response) => {
console.log("CategoryService", cacheKey);
if (response.categoryTree) {
if (response.translatedCategoryTree) {
if (!window.categoryCache) {
window.categoryCache = {};
}
window.categoryCache[cacheKey] = response.translatedCategoryTree;
console.log("mutex unlocked and returning new value");
resolve(response.translatedCategoryTree);
} else if (response.categoryTree) {
if (!window.categoryCache) {
window.categoryCache = {};
}