Improved inventory

This commit is contained in:
2017-10-05 09:39:37 +02:00
parent 77ae39d330
commit 09d28e146c
5 changed files with 69 additions and 15 deletions

View File

@ -14,22 +14,17 @@ import (
// Get inventory page.
func Get(ctx *aero.Context) string {
user := utils.GetUser(ctx)
viewUser := user
if user == nil {
return ctx.Error(http.StatusUnauthorized, "Not logged in", nil)
}
inventory, err := arn.GetInventory(user.ID)
inventory, err := arn.GetInventory(viewUser.ID)
if err != nil {
return ctx.Error(http.StatusInternalServerError, "Error fetching inventory data", err)
}
// 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)
return ctx.HTML(components.Inventory(inventory))
return ctx.HTML(components.Inventory(inventory, viewUser))
}