24 lines
454 B
Go
Raw Normal View History

2018-04-25 17:12:47 +00:00
package post
import (
2017-06-27 22:16:45 +00:00
"net/http"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
2017-07-06 14:54:10 +00:00
"github.com/animenotifier/notify.moe/utils"
)
2017-06-16 23:25:02 +00:00
// Get post.
func Get(ctx *aero.Context) string {
id := ctx.Get("id")
2017-07-06 14:54:10 +00:00
user := utils.GetUser(ctx)
post, err := arn.GetPost(id)
if err != nil {
2017-06-27 22:16:45 +00:00
return ctx.Error(http.StatusNotFound, "Post not found", err)
}
2017-07-06 14:54:10 +00:00
return ctx.HTML(components.Post(post, user))
}