diff options
Diffstat (limited to 'internal/handlers')
-rw-r--r-- | internal/handlers/main.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/internal/handlers/main.go b/internal/handlers/main.go index 3f2e1b2..1f3f740 100644 --- a/internal/handlers/main.go +++ b/internal/handlers/main.go @@ -37,6 +37,23 @@ func (h *Handlers) Ping(w http.ResponseWriter, r *http.Request) { w.Write([]byte("pong")) } +func (h *Handlers) HandleAnswer(w http.ResponseWriter, r *http.Request) { + if err := r.ParseForm(); err != nil { + abortWithError(w, "Invalid form data") + return + } + + selectedIndex := r.FormValue("selected") + questionID := r.FormValue("question_id") + h.log.Info("answer received", + "selected", selectedIndex, + "question_id", questionID) + + // TODO: Add actual answer validation logic here + // For now just return the same question + h.MainPage(w, r) +} + func (h *Handlers) MainPage(w http.ResponseWriter, r *http.Request) { tmpl, err := template.ParseGlob("components/*.html") if err != nil { |