summaryrefslogtreecommitdiff
path: root/internal/handlers
diff options
context:
space:
mode:
authorGrail Finder (aider) <wohilas@gmail.com>2025-03-29 14:44:08 +0300
committerGrail Finder (aider) <wohilas@gmail.com>2025-03-29 14:44:08 +0300
commit194e66b403fd6cb101707c26908c1bc6d81a6555 (patch)
tree48f1f497ec86f746403e28541c520a4bc7a4f18f /internal/handlers
parent01a128d9f93960599c0f20beb640b5b035015893 (diff)
feat: add answer handler with question ID tracking
Diffstat (limited to 'internal/handlers')
-rw-r--r--internal/handlers/main.go17
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 {