mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-01-29 22:40:22 +00:00
get page query param. set default of 1 if not set
This commit is contained in:
@@ -72,7 +72,7 @@ func GetCC(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
builds, err := store.GetBuildList(c, repo)
|
||||
builds, err := store.GetBuildList(c, repo, 1)
|
||||
if err != nil || len(builds) == 0 {
|
||||
c.AbortWithStatus(404)
|
||||
return
|
||||
|
||||
@@ -25,7 +25,13 @@ import (
|
||||
|
||||
func GetBuilds(c *gin.Context) {
|
||||
repo := session.Repo(c)
|
||||
builds, err := store.GetBuildList(c, repo)
|
||||
page, err := strconv.Atoi(c.DefaultQuery("page", "1"))
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
return
|
||||
}
|
||||
|
||||
builds, err := store.GetBuildList(c, repo, page)
|
||||
if err != nil {
|
||||
c.AbortWithStatus(http.StatusInternalServerError)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user