mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 23:33:13 +08:00
Added pagination to ShortUrls list
This commit is contained in:
@@ -8,6 +8,7 @@ use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Zend\Diactoros\Response\JsonResponse;
|
||||
use Zend\Stdlib\ArrayUtils;
|
||||
use Zend\Stratigility\MiddlewareInterface;
|
||||
|
||||
class ListShortcodesMiddleware implements MiddlewareInterface
|
||||
@@ -60,8 +61,11 @@ class ListShortcodesMiddleware implements MiddlewareInterface
|
||||
|
||||
return new JsonResponse([
|
||||
'shortUrls' => [
|
||||
'data' => $shortUrls,
|
||||
// 'pagination' => [],
|
||||
'data' => ArrayUtils::iteratorToArray($shortUrls->getCurrentItems()),
|
||||
'pagination' => [
|
||||
'currentPage' => $shortUrls->getCurrentPageNumber(),
|
||||
'pagesCount' => $shortUrls->count(),
|
||||
],
|
||||
]
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
Reference in New Issue
Block a user