24 lines
466 B
Go
Raw Normal View History

2016-11-19 23:54:31 +09:00
package anime
import (
2017-06-19 20:59:02 +02:00
"net/http"
2016-11-19 23:54:31 +09:00
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
2017-06-19 20:59:02 +02:00
"github.com/animenotifier/notify.moe/utils"
2016-11-19 23:54:31 +09:00
)
2017-06-17 01:25:02 +02:00
// Get anime page.
2016-11-19 23:54:31 +09:00
func Get(ctx *aero.Context) string {
2017-06-04 01:17:00 +02:00
id := ctx.Get("id")
2017-06-19 20:59:02 +02:00
user := utils.GetUser(ctx)
2016-11-19 23:54:31 +09:00
anime, err := arn.GetAnime(id)
if err != nil {
2017-06-19 20:59:02 +02:00
return ctx.Error(http.StatusNotFound, "Anime not found", err)
2016-11-19 23:54:31 +09:00
}
2017-06-19 20:59:02 +02:00
return ctx.HTML(components.Anime(anime, user))
2016-11-19 23:54:31 +09:00
}