From f28288dd3208aa99381c22c6bb9713a6e7714b5e Mon Sep 17 00:00:00 2001 From: Emile Date: Sun, 20 Oct 2019 12:24:39 +0200 Subject: fixed the edit function + error handling --- src/http.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/http.go') diff --git a/src/http.go b/src/http.go index 443b6a3..e7e874d 100644 --- a/src/http.go +++ b/src/http.go @@ -150,6 +150,7 @@ func editGetHandler(w http.ResponseWriter, r *http.Request) { if r.URL.Query()["uuid"] == nil { log.Println("editnoparam") + http.Redirect(w, r, "/editSelect", http.StatusSeeOther) return } uuid = r.URL.Query()["uuid"][0] @@ -214,7 +215,12 @@ func editPostHandler(w http.ResponseWriter, r *http.Request) { } // update the challenge in the database - dbEditChallengeUUID(r.Form.Get("challengeUUID"), editedChallenge) + EditError := dbEditChallengeUUID(r.Form.Get("challengeUUID"), editedChallenge) + if EditError != nil { + log.Println("Could not edit:") + log.Println(EditError) + } + log.Println("done editing challenge!") http.Redirect(w, r, "/edit", http.StatusSeeOther) -- cgit 1.4.1