Moved category handlers to the end.
This commit is contained in:
parent
3566fc8a58
commit
e573870503
@ -257,22 +257,6 @@ func (h *MindflowApiHandlers) New(w http.ResponseWriter, r *http.Request) {
|
||||
http.Redirect(w, r, "/mindflow/admin", http.StatusMovedPermanently)
|
||||
}
|
||||
|
||||
func (h *MindflowApiHandlers) DeleteCategory(w http.ResponseWriter, r *http.Request) {
|
||||
id, _ := strconv.ParseInt(GetURLParam(r, "id"), 10, 64)
|
||||
if err := h.db.DeleteCategory(id); err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func (h *MindflowApiHandlers) DeleteUnusedCategories(w http.ResponseWriter, r *http.Request) {
|
||||
if err := h.db.DeleteUnusedCategories(); err != nil {
|
||||
log.Println("Cannot delete unused categories:", err)
|
||||
http.Error(w, "Cannot delete unused categories: "+err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func (h *MindflowApiHandlers) Edit(w http.ResponseWriter, r *http.Request) {
|
||||
var post *mindflow.Post
|
||||
var err error
|
||||
@ -330,3 +314,19 @@ func (h *MindflowApiHandlers) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
func (h *MindflowApiHandlers) DeleteCategory(w http.ResponseWriter, r *http.Request) {
|
||||
id, _ := strconv.ParseInt(GetURLParam(r, "id"), 10, 64)
|
||||
if err := h.db.DeleteCategory(id); err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func (h *MindflowApiHandlers) DeleteUnusedCategories(w http.ResponseWriter, r *http.Request) {
|
||||
if err := h.db.DeleteUnusedCategories(); err != nil {
|
||||
log.Println("Cannot delete unused categories:", err)
|
||||
http.Error(w, "Cannot delete unused categories: "+err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user