diff --git a/frontend/src/components/falukant/StatusBar.vue b/frontend/src/components/falukant/StatusBar.vue index bd34c26..29ec93c 100644 --- a/frontend/src/components/falukant/StatusBar.vue +++ b/frontend/src/components/falukant/StatusBar.vue @@ -68,7 +68,9 @@ export default { methods: { async fetchStatus() { try { + console.log('🔄 StatusBar: fetchStatus() startet...'); const response = await apiClient.get("/api/falukant/info"); + console.log('📊 StatusBar: API Response erhalten:', response.data); const { money, character, events } = response.data; const { age, health } = character; const relationship = response.data.character.relationshipsAsCharacter1[0]?.relationshipType?.tr @@ -99,6 +101,7 @@ export default { { key: "events", icon: "📰", value: events || null, image: null }, { key: "children", icon: "👶", value: childrenDisplay }, ]; + console.log('📊 StatusBar: statusItems aktualisiert:', this.statusItems); } catch (error) { console.error("Error fetching status:", error); } diff --git a/frontend/src/views/falukant/BranchView.vue b/frontend/src/views/falukant/BranchView.vue index cc96737..7bad6fa 100644 --- a/frontend/src/views/falukant/BranchView.vue +++ b/frontend/src/views/falukant/BranchView.vue @@ -75,7 +75,7 @@ export default { // Daemon WebSocket deaktiviert - verwende Socket.io this.setupSocketEvents(); - // Live-Socket-Events + // Live-Socket-Events - nur für Events ohne spezielle Behandlung [ "production_ready", "stock_change", @@ -83,8 +83,6 @@ export default { "director_death", "production_started", "selled_items", - "falukantUpdateStatus", - "falukantBranchUpdate", "knowledge_update" ].forEach(eventName => { if (this.socket) { @@ -95,8 +93,10 @@ export default { beforeUnmount() { if (this.socket) { + // Entferne spezielle Event-Listener this.socket.off("falukantBranchUpdate"); this.socket.off("falukantUpdateStatus"); + // Entferne allgemeine Event-Listener this.socket.off("production_ready"); this.socket.off("stock_change"); this.socket.off("price_update"); @@ -247,10 +247,38 @@ export default { case 'falukantBranchUpdate': console.log('🔄 BranchView: Lade alle Sektionen für', eventData.event); console.log('🔄 BranchView: StatusBar ref:', this.$refs.statusBar); - this.$refs.statusBar?.fetchStatus(); - this.$refs.productionSection?.loadProductions(); - this.$refs.storageSection?.loadStorageData(); - this.$refs.saleSection?.loadInventory(); + console.log('🔄 BranchView: ProductionSection ref:', this.$refs.productionSection); + console.log('🔄 BranchView: StorageSection ref:', this.$refs.storageSection); + console.log('🔄 BranchView: SaleSection ref:', this.$refs.saleSection); + + if (this.$refs.statusBar) { + console.log('🔄 BranchView: Rufe StatusBar.fetchStatus() auf...'); + this.$refs.statusBar.fetchStatus(); + } else { + console.log('⚠️ BranchView: StatusBar ref nicht verfügbar'); + } + + if (this.$refs.productionSection) { + console.log('🔄 BranchView: Rufe ProductionSection.loadProductions() auf...'); + this.$refs.productionSection.loadProductions(); + } else { + console.log('⚠️ BranchView: ProductionSection ref nicht verfügbar'); + } + + if (this.$refs.storageSection) { + console.log('🔄 BranchView: Rufe StorageSection.loadStorageData() auf...'); + this.$refs.storageSection.loadStorageData(); + } else { + console.log('⚠️ BranchView: StorageSection ref nicht verfügbar'); + } + + if (this.$refs.saleSection) { + console.log('🔄 BranchView: Rufe SaleSection.loadInventory() auf...'); + this.$refs.saleSection.loadInventory(); + } else { + console.log('⚠️ BranchView: SaleSection ref nicht verfügbar'); + } + console.log('✅ BranchView: Alle Sektionen aktualisiert'); break; case 'knowledge_update':