mirror of
https://github.com/umami-software/umami.git
synced 2026-02-13 09:05:36 +01:00
Unified loading states.
This commit is contained in:
parent
7b5591a3ce
commit
da8c7e99c5
52 changed files with 506 additions and 364 deletions
|
|
@ -0,0 +1,25 @@
|
|||
import { parseRequest } from '@/lib/request';
|
||||
import { unauthorized, json } from '@/lib/response';
|
||||
import { canViewWebsite } from '@/lib/auth';
|
||||
import { getEventData } from '@/queries/sql/events/getEventData';
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
{ params }: { params: Promise<{ websiteId: string; eventId: string }> },
|
||||
) {
|
||||
const { auth, error } = await parseRequest(request);
|
||||
|
||||
if (error) {
|
||||
return error();
|
||||
}
|
||||
|
||||
const { websiteId, eventId } = await params;
|
||||
|
||||
if (!(await canViewWebsite(auth, websiteId))) {
|
||||
return unauthorized();
|
||||
}
|
||||
|
||||
const data = await getEventData(eventId);
|
||||
|
||||
return json(data);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue