functioning form submission

Co-authored-by: Sindre Kjelsrud <kjelsrudsindre@gmail.com>
This commit is contained in:
haraldnilsen 2024-01-07 21:33:25 +01:00
parent 9f113c1258
commit 3fefb35db0
2 changed files with 75 additions and 23 deletions

View file

@ -20,7 +20,7 @@ type UserformData struct {
type FormData struct {
FormAnswers string `json:"allFormAnswers"`
RespondentId int `json:"respondentID"`
RespondentId int `json:"respondentID"`
}
func main() {
@ -77,7 +77,7 @@ func main() {
fmt.Print(err)
}
respondentID, err := db.InsertUserAnswers(requestBody.RespondentId, requestBody.FormAnswers)
err := db.InsertUserAnswers(requestBody.RespondentId, requestBody.FormAnswers)
if err != nil {
fmt.Print(err)
@ -86,7 +86,7 @@ func main() {
}
// Respond with the ID of the newly inserted respondent
c.JSON(http.StatusOK, gin.H{"respondentID": respondentID})
c.JSON(http.StatusOK, "Successfully inserted formdata!")
})
// Run the server on port 8080