From c8829fc08bf4da949ccf2a91ae8525bb20ca7b44 Mon Sep 17 00:00:00 2001 From: Agusti Fernandez Pardo Date: Fri, 8 Jul 2022 20:19:51 +0200 Subject: [PATCH] fix: rename pageNumber to page --- lib/helpers/withPagination.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/helpers/withPagination.ts b/lib/helpers/withPagination.ts index 2bcd219b33..d8c68fdd3b 100644 --- a/lib/helpers/withPagination.ts +++ b/lib/helpers/withPagination.ts @@ -2,7 +2,7 @@ import { NextMiddleware } from "next-api-middleware"; import z from "zod"; const withPage = z.object({ - pageNumber: z + page: z .string() .min(1) .default("1") @@ -16,8 +16,8 @@ const withPage = z.object({ }); export const withPagination: NextMiddleware = async (req, _, next) => { - const { pageNumber, take } = withPage.parse(req.query); - const skip = pageNumber * take; + const { page, take } = withPage.parse(req.query); + const skip = page * take; req.pagination = { take: take || 10, skip: skip || 0,