From 6ac04b2ae105209c8ca3375c4db494cf6a885546 Mon Sep 17 00:00:00 2001 From: Bardioc26 <13843924+Bardioc26@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:59:16 +0100 Subject: [PATCH] Char skill edit not saved (#36) * Skill edit was not saved * show warning when skill name is to be edited in char_skills --- backend/character/handlers.go | 12 ++- frontend/src/components/CharacterDetails.vue | 8 +- frontend/src/components/SkillView.vue | 80 ++++++++++++++++++-- frontend/src/locales/de | 3 +- frontend/src/locales/en | 3 +- 5 files changed, 97 insertions(+), 9 deletions(-) diff --git a/backend/character/handlers.go b/backend/character/handlers.go index 549a49f..41a6f67 100644 --- a/backend/character/handlers.go +++ b/backend/character/handlers.go @@ -147,7 +147,17 @@ func UpdateCharacter(c *gin.Context) { return } - c.JSON(http.StatusOK, character) + // Reload character to get updated data + var updatedCharacter models.Char + err = updatedCharacter.FirstID(id) + if err != nil { + respondWithError(c, http.StatusInternalServerError, "Failed to reload character") + return + } + + // Return as FeChar with categorized skills + feChar := ToFeChar(&updatedCharacter) + c.JSON(http.StatusOK, feChar) } func DeleteCharacter(c *gin.Context) { id := c.Param("id") diff --git a/frontend/src/components/CharacterDetails.vue b/frontend/src/components/CharacterDetails.vue index aabbcbd..419889b 100644 --- a/frontend/src/components/CharacterDetails.vue +++ b/frontend/src/components/CharacterDetails.vue @@ -32,7 +32,7 @@ - + @@ -156,6 +156,12 @@ export default { alert('Fehler beim Aktualisieren der Charakterdaten: ' + (error.response?.data?.error || error.message)); } }, + + updateCharacterData(updatedData) { + // Update character data directly without reloading from server + this.character = updatedData; + console.log('Character data updated directly from response'); + }, }, }; \ No newline at end of file diff --git a/frontend/src/components/SkillView.vue b/frontend/src/components/SkillView.vue index 50a39d2..cdb75ae 100644 --- a/frontend/src/components/SkillView.vue +++ b/frontend/src/components/SkillView.vue @@ -55,6 +55,15 @@ + + +
+ ⚠️ + + {{ $t('characters.datasheet.editnamewarning') }} + +
+ @@ -384,6 +393,29 @@ transform: translateX(0); } } + +.warning-message { + display: flex; + align-items: center; + gap: 10px; + padding: 12px 16px; + margin: 10px 0; + background-color: #fff3cd; + border: 1px solid #ffc107; + border-radius: 6px; + color: #856404; + animation: slideIn 0.3s ease; +} + +.warning-icon { + font-size: 1.2rem; + flex-shrink: 0; +} + +.warning-text { + font-size: 0.9rem; + line-height: 1.4; +}