General History Drawer now works

This commit is contained in:
2024-07-29 14:54:29 -05:00
parent 8a00507431
commit c95ee5957c
4 changed files with 96 additions and 27 deletions

View File

@@ -8,6 +8,7 @@ export const GET = async (request: Request) => {
const url = new URL(request.url);
const apiKey = url.searchParams.get('apikey');
const page = Number(url.searchParams.get('page')) || 1;
const perPage = Number(url.searchParams.get('per_page')) || 50;
if (apiKey !== process.env.API_KEY) {
const session = await auth();
if (!session)
@@ -16,7 +17,6 @@ export const GET = async (request: Request) => {
{ status: 401 }
);
}
const perPage = 50;
const historyData = await getHistory(page, perPage);
return NextResponse.json(historyData, { status: 200 });
} catch (error) {