Currently we have some license issues. We are working on it.

Commit b8a2fe86 authored by zauberstuhl's avatar zauberstuhl
Browse files

Remove redirects from API

This should be handle by the application server
parent 8697ebe6
......@@ -47,12 +47,13 @@ func (c ApiComment) Index() revel.Result {
func (c ApiComment) Create() revel.Result {
var (
comment string
comment, fields string
postID uint
post models.Post
c.Params.Bind(&comment, "comment")
c.Params.Bind(&fields, "fields")
c.Params.Bind(&postID, "id")
user, err := models.CurrentUser(c.Params, c.Session)
......@@ -77,7 +78,8 @@ func (c ApiComment) Create() revel.Result {
go dispatcher.Run()
return c.Redirect("/")
// XXX that should return the comment
return c.RenderJSON(post)
func (c ApiComment) Show() revel.Result {
......@@ -65,11 +65,12 @@ func (p ApiPost) Index() revel.Result {
func (p ApiPost) Create() revel.Result {
var (
post models.Post
postText string
postText, fields string
aspectID uint
p.Params.Bind(&postText, "post")
p.Params.Bind(&fields, "fields")
p.Params.Bind(&aspectID, "aspectID")
emptyPost, err := regexp.MatchString(`^\s*?$`, postText)
......@@ -144,7 +145,8 @@ func (p ApiPost) Create() revel.Result {
go dispatcher.Run()
return p.Redirect("/")
return p.RenderJSON(
apiHelpers.SelectStructFields(post, fields))
func (p ApiPost) Show(guid string) revel.Result {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment