mirror of
https://github.com/umami-software/umami.git
synced 2026-02-11 16:17:13 +01:00
Merged auth into new parseRequest method.
This commit is contained in:
parent
e51f182403
commit
2d6428172b
39 changed files with 296 additions and 316 deletions
|
|
@ -1,16 +1,21 @@
|
|||
import { canViewWebsite, checkAuth } from 'lib/auth';
|
||||
import { canViewWebsite } from 'lib/auth';
|
||||
import { json, unauthorized } from 'lib/response';
|
||||
import { getActiveVisitors } from 'queries';
|
||||
import { parseRequest } from 'lib/request';
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
{ params }: { params: Promise<{ websiteId: string }> },
|
||||
) {
|
||||
const { auth, error } = await parseRequest(request);
|
||||
|
||||
if (error) {
|
||||
return error();
|
||||
}
|
||||
|
||||
const { websiteId } = await params;
|
||||
|
||||
const auth = await checkAuth(request);
|
||||
|
||||
if (!auth || !(await canViewWebsite(auth, websiteId))) {
|
||||
if (!(await canViewWebsite(auth, websiteId))) {
|
||||
return unauthorized();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue