36 lines
770 B
Go
Raw Normal View History

2017-10-04 06:12:12 +00:00
package inventory
import (
"net/http"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
"github.com/aerogo/aero"
"github.com/animenotifier/notify.moe/utils"
)
// Get inventory page.
func Get(ctx *aero.Context) string {
user := utils.GetUser(ctx)
if user == nil {
return ctx.Error(http.StatusUnauthorized, "Not logged in", nil)
}
inventory, err := arn.GetInventory(user.ID)
if err != nil {
return ctx.Error(http.StatusInternalServerError, "Error fetching inventory data", err)
}
2017-10-04 11:39:59 +00:00
// TEST
inventory.AddItem("anime-support-ticket", 35)
inventory.AddItem("pro-account-24", 20)
inventory.AddItem("anime-support-ticket", 15)
inventory.AddItem("pro-account-24", 10)
2017-10-04 06:12:12 +00:00
return ctx.HTML(components.Inventory(inventory))
}