make API pagination optional

This commit is contained in:
6543 2020-03-11 21:54:38 +01:00
parent e03d627769
commit 05bb9d06da

View File

@ -41,8 +41,12 @@ func GetQueryBeforeSince(ctx *context.APIContext) (before, since int64, err erro
// GetListOptions returns list options using the page and limit parameters
func GetListOptions(ctx *context.APIContext) models.ListOptions {
page := ctx.QueryInt("page")
if page == 0 {
return models.ListOptions{}
}
return models.ListOptions{
Page: ctx.QueryInt("page"),
Page: page,
PageSize: convert.ToCorrectPageSize(ctx.QueryInt("limit")),
}
}