mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[chore] much improved paging package (#2182)
This commit is contained in:
@@ -103,8 +103,12 @@ func (m *Module) BlocksGETHandler(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
limit, errWithCode := apiutil.ParseLimit(c.Query(LimitKey), 20, 100, 2)
|
||||
if err != nil {
|
||||
page, errWithCode := paging.ParseIDPage(c,
|
||||
1, // min limit
|
||||
100, // max limit
|
||||
20, // default limit
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
@@ -112,11 +116,7 @@ func (m *Module) BlocksGETHandler(c *gin.Context) {
|
||||
resp, errWithCode := m.processor.BlocksGet(
|
||||
c.Request.Context(),
|
||||
authed.Account,
|
||||
paging.Pager{
|
||||
SinceID: c.Query(SinceIDKey),
|
||||
MaxID: c.Query(MaxIDKey),
|
||||
Limit: limit,
|
||||
},
|
||||
page,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
|
Reference in New Issue
Block a user