Error handling for CreateUser query

This commit is contained in:
Maximilian 2022-10-22 12:18:14 -05:00
parent 93a1cb6049
commit a590c96d0b

View File

@ -24,7 +24,12 @@ func (postController *PostController) Register(w http.ResponseWriter, r *http.Re
http.Redirect(w, r, "/register", http.StatusFound)
}
models.CreateUser(postController.App, username, password, createdAt, updatedAt)
_, err := models.CreateUser(postController.App, username, password, createdAt, updatedAt)
if err != nil {
log.Println("Error creating user")
log.Println(err)
return
}
http.Redirect(w, r, "/login", http.StatusFound)
}