Fix settings not closing on submit bug

This commit is contained in:
2024-09-27 23:28:19 +02:00
parent cf3ad5f389
commit 122860d230
4 changed files with 27 additions and 9 deletions

View File

@@ -120,6 +120,15 @@ func UpdateSettings(db *db.DB) http.HandlerFunc {
return
}
// Fetch the saved settings to return
savedSettings, err := db.GetSettings(settings.UserID)
if err != nil {
http.Error(w, "Settings saved but could not be retrieved", http.StatusInternalServerError)
return
}
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
json.NewEncoder(w).Encode(savedSettings)
}
}