mirror of
https://github.com/umami-software/umami.git
synced 2026-02-09 23:27:12 +01:00
Add back pageSize.
This commit is contained in:
parent
d5c4202ee4
commit
9732d0e6ef
8 changed files with 24 additions and 10 deletions
|
|
@ -5,6 +5,7 @@ import { NextApiRequestQueryBody, SearchFilter } from 'lib/types';
|
|||
import { NextApiResponse } from 'next';
|
||||
import { methodNotAllowed, ok, unauthorized } from 'next-basics';
|
||||
import { getReportsByWebsiteId } from 'queries';
|
||||
import { pageInfo } from 'lib/schema';
|
||||
|
||||
export interface ReportsRequestQuery extends SearchFilter {
|
||||
id: string;
|
||||
|
|
@ -13,6 +14,7 @@ export interface ReportsRequestQuery extends SearchFilter {
|
|||
const schema = {
|
||||
GET: yup.object().shape({
|
||||
id: yup.string().uuid().required(),
|
||||
...pageInfo,
|
||||
}),
|
||||
};
|
||||
|
||||
|
|
@ -27,14 +29,15 @@ export default async (
|
|||
const { id: websiteId } = req.query;
|
||||
|
||||
if (req.method === 'GET') {
|
||||
if (!(websiteId && (await canViewWebsite(req.auth, websiteId)))) {
|
||||
if (!(await canViewWebsite(req.auth, websiteId))) {
|
||||
return unauthorized(res);
|
||||
}
|
||||
|
||||
const { page, query } = req.query;
|
||||
const { page, query, pageSize } = req.query;
|
||||
|
||||
const data = await getReportsByWebsiteId(websiteId, {
|
||||
page,
|
||||
pageSize: +pageSize || undefined,
|
||||
query,
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue