Shop improvements
This commit is contained in:
29
pages/inventory/inventory.go
Normal file
29
pages/inventory/inventory.go
Normal file
@ -0,0 +1,29 @@
|
||||
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)
|
||||
}
|
||||
|
||||
return ctx.HTML(components.Inventory(inventory))
|
||||
}
|
Reference in New Issue
Block a user