package web import ( "net/http" "github.com/Jaculabilis/intake/core" "github.com/Jaculabilis/intake/web/html" ) func (env *Env) getItem(writer http.ResponseWriter, req *http.Request) { source := req.PathValue("source") id := req.PathValue("id") item, err := core.GetItem(env.db, source, id) if err != nil { writer.Write([]byte(err.Error())) return } html.Item(writer, html.ItemData{Item: item}) } func (env *Env) deleteItem(writer http.ResponseWriter, req *http.Request) { source := req.PathValue("source") id := req.PathValue("id") _, err := core.DeactivateItem(env.db, source, id) if err != nil { writer.Write([]byte(err.Error())) return } item, err := core.GetItem(env.db, source, id) if err != nil { writer.Write([]byte(err.Error())) return } html.Item(writer, html.ItemData{Item: item}) }