diff --git a/main.go b/main.go index 569ec59..961f655 100644 --- a/main.go +++ b/main.go @@ -95,11 +95,13 @@ func (s *server) HandleToggle() http.HandlerFunc { if err != nil { http.Error(w, "Bad id", http.StatusBadRequest) + return } err = s.db.ToggleTodo(id) if err != nil { http.Error(w, "failed to toggle", http.StatusInternalServerError) + return } http.Redirect(w, r, "/", http.StatusSeeOther)