From 3bdb77888f74e1527b254ee4ee7e3398873c720a Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Thu, 29 Jan 2026 09:20:10 +0100 Subject: [PATCH] Enhance NobilityView with debugging information: Add conditional rendering for advance section based on availability of next title information. Implement detailed console logs for loading and advancing nobility data, improving error handling and debugging capabilities. --- frontend/src/views/falukant/NobilityView.vue | 46 +++++++++++++++++--- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/frontend/src/views/falukant/NobilityView.vue b/frontend/src/views/falukant/NobilityView.vue index b7d96af..b7f7303 100644 --- a/frontend/src/views/falukant/NobilityView.vue +++ b/frontend/src/views/falukant/NobilityView.vue @@ -18,7 +18,7 @@
-
+

{{ $t('falukant.nobility.nextTitle') }}: {{ $t(`falukant.titles.${gender}.${next.labelTr}`) }} @@ -26,7 +26,7 @@

{{ $t('falukant.nobility.cooldown', { date: formatDate(nextAdvanceAt) }) }}

-
    +
    • {{ $t(`falukant.nobility.requirement.${req.requirementType}`, { amount: formatCost(req.requirementValue) }) }}
    • @@ -35,6 +35,18 @@ {{ $t('falukant.nobility.advance.confirm') }} {{ $t('falukant.nobility.advance.processing') }} +
      + Debug: canAdvance={{ canAdvance }}, isAdvancing={{ isAdvancing }}, next={{ next ? 'exists' : 'null' }}, nextAdvanceAt={{ nextAdvanceAt }} +
      +
      + Debug: canAdvance = false (next: {{ next ? 'exists' : 'null' }}, nextAdvanceAt: {{ nextAdvanceAt }}) +
      +
+
+

Fehler: Keine nächste Titel-Information verfügbar. Bitte Seite neu laden.

+
+ Debug: next={{ next }}, next.labelTr={{ next ? next.labelTr : 'N/A' }} +
@@ -105,19 +117,41 @@ }, async loadNobility() { try { + console.log('[NobilityView] Loading nobility data...'); const { data } = await apiClient.get('/api/falukant/nobility'); - this.current = data.current; - this.next = data.next; + console.log('[NobilityView] Received data:', data); + this.current = data.current || { labelTr: '', requirements: [], charactersWithNobleTitle: [] }; + this.next = data.next || { labelTr: '', requirements: [] }; this.nextAdvanceAt = data.nextAdvanceAt || null; + console.log('[NobilityView] Updated state:', { + current: this.current, + next: this.next, + nextAdvanceAt: this.nextAdvanceAt, + canAdvance: this.canAdvance + }); } catch (err) { - console.error('Error loading nobility:', err); + console.error('[NobilityView] Error loading nobility:', err); } }, async applyAdvance() { - if (!this.canAdvance || this.isAdvancing) return; + console.log('[NobilityView] applyAdvance called', { + canAdvance: this.canAdvance, + isAdvancing: this.isAdvancing, + next: this.next, + nextAdvanceAt: this.nextAdvanceAt + }); + if (!this.canAdvance || this.isAdvancing) { + console.log('[NobilityView] applyAdvance blocked:', { + canAdvance: this.canAdvance, + isAdvancing: this.isAdvancing + }); + return; + } this.isAdvancing = true; try { + console.log('[NobilityView] Sending POST request to /api/falukant/nobility'); await apiClient.post('/api/falukant/nobility'); + console.log('[NobilityView] POST request successful, reloading nobility data'); await this.loadNobility(); } catch (err) { console.error('Error advancing nobility:', err);