issue #20 add sort, not yet in view
All checks were successful
Go / build (push) Successful in 12m10s
All checks were successful
Go / build (push) Successful in 12m10s
This commit is contained in:
@@ -333,8 +333,20 @@ func (rc *UserController) InviteHandler(c *gin.Context) {
|
||||
}
|
||||
|
||||
func (rc *UserController) MainView(c *gin.Context) {
|
||||
shopItems, _ := repositories.ShopItems.GetAll()
|
||||
fmt.Println(len(shopItems))
|
||||
itemOrder := c.Query("order")
|
||||
|
||||
var shopItems []models.ShopItem
|
||||
if itemOrder == "newestFirst" {
|
||||
shopItems, _ = repositories.ShopItems.GetAllNewestFirst()
|
||||
} else if itemOrder == "oldestFirst" {
|
||||
shopItems, _ = repositories.ShopItems.GetAllNewestLast()
|
||||
} else if itemOrder == "az" {
|
||||
shopItems, _ = repositories.ShopItems.GetAllLexicalFirst()
|
||||
} else if itemOrder == "za" {
|
||||
shopItems, _ = repositories.ShopItems.GetAllLexicalLast()
|
||||
} else {
|
||||
shopItems, _ = repositories.ShopItems.GetAllNewestFirst()
|
||||
}
|
||||
|
||||
data := CreateSessionData(c, gin.H{
|
||||
"title": "shopItem Page",
|
||||
|
||||
Reference in New Issue
Block a user