Servers ITEMS_PER_PAGE

This commit is contained in:
headlessdev
2025-04-14 21:26:12 +02:00
parent 0a8ea98dae
commit 8fc4fea687
2 changed files with 10 additions and 4 deletions

View File

@@ -2,15 +2,16 @@ import { NextResponse, NextRequest } from "next/server";
import { prisma } from "@/lib/prisma";
interface GetRequest {
page: number;
page?: number;
ITEMS_PER_PAGE?: number;
}
const ITEMS_PER_PAGE = 5;
export async function POST(request: NextRequest) {
try {
const body: GetRequest = await request.json();
const page = Math.max(1, body.page || 1);
const ITEMS_PER_PAGE = body.ITEMS_PER_PAGE || 4;
const servers = await prisma.server.findMany({
skip: (page - 1) * ITEMS_PER_PAGE,