set up better ux for using categories

This commit is contained in:
2024-03-13 03:06:23 +00:00
parent 4fd0e72a86
commit 066e6d2a09
12 changed files with 107 additions and 33 deletions

View File

@@ -107,11 +107,18 @@ func GetItemByID(r *http.Request) *web.Response {
func Put(r *http.Request) *web.Response {
id, _ := web.PathLast(r)
err := r.ParseForm()
if err != nil {
if err := r.ParseForm(); err != nil {
return web.Error(http.StatusBadRequest, err, nil)
}
if r.Form.Get("category") == "" {
panic(r.Form.Get(""))
}
if r.Form.Get("stage") == "" {
panic(r.Form.Get(""))
}
name := r.Form.Get("name")
stage := r.Form.Get("stage")
category := r.Form.Get("category")
@@ -145,9 +152,7 @@ func Put(r *http.Request) *web.Response {
}(),
}
_, err = db.PutItem(item)
if err != nil {
if _, err := db.PutItem(item); err != nil {
return web.Error(http.StatusInternalServerError, err, nil)
}