mirror of
https://github.com/umami-software/umami.git
synced 2026-02-08 06:37:18 +01:00
Add Search Api/Components.
This commit is contained in:
parent
45888fabe6
commit
dcf8b2edaa
37 changed files with 1069 additions and 287 deletions
|
|
@ -1,12 +1,14 @@
|
|||
import { canCreateWebsite } from 'lib/auth';
|
||||
import { uuid } from 'lib/crypto';
|
||||
import { useAuth, useCors } from 'lib/middleware';
|
||||
import { NextApiRequestQueryBody } from 'lib/types';
|
||||
import { NextApiRequestQueryBody, SearchFilter, WebsiteSearchFilterType } from 'lib/types';
|
||||
import { NextApiResponse } from 'next';
|
||||
import { methodNotAllowed, ok, unauthorized } from 'next-basics';
|
||||
import { createWebsite } from 'queries';
|
||||
import userWebsites from 'pages/api/users/[id]/websites';
|
||||
|
||||
export interface WebsitesRequestQuery extends SearchFilter<WebsiteSearchFilterType> {}
|
||||
|
||||
export interface WebsitesRequestBody {
|
||||
name: string;
|
||||
domain: string;
|
||||
|
|
@ -14,7 +16,7 @@ export interface WebsitesRequestBody {
|
|||
}
|
||||
|
||||
export default async (
|
||||
req: NextApiRequestQueryBody<any, WebsitesRequestBody>,
|
||||
req: NextApiRequestQueryBody<WebsitesRequestQuery, WebsitesRequestBody>,
|
||||
res: NextApiResponse,
|
||||
) => {
|
||||
await useCors(req, res);
|
||||
|
|
@ -26,6 +28,7 @@ export default async (
|
|||
|
||||
if (req.method === 'GET') {
|
||||
req.query.id = userId;
|
||||
req.query.pageSize = 100;
|
||||
|
||||
return userWebsites(req, res);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue