mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-23 00:46:30 +00:00
get page query param. set default of 1 if not set
This commit is contained in:
parent
af76d46b53
commit
c84031e3e8
2 changed files with 8 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue