Create new category implemented.
This commit is contained in:
parent
5b4cc67fda
commit
83720a317e
@ -230,7 +230,11 @@ func (h *MindflowApiHandlers) New(w http.ResponseWriter, r *http.Request) {
|
||||
category_id, _ := strconv.ParseInt(r.FormValue("category"), 10, 64)
|
||||
|
||||
if category_id == 0 {
|
||||
// TODO: create category
|
||||
category_id, err = h.db.NewCategory(r.FormValue("new-category"))
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
post, err = mindflow.NewPost(mindflow.Category{ID: category_id}, r.FormValue("title"), r.FormValue("body"))
|
||||
|
Loading…
Reference in New Issue
Block a user