mirror of
https://github.com/umami-software/umami.git
synced 2026-02-09 15:17:23 +01:00
Converted reports and share routes.
This commit is contained in:
parent
dcac7b7c96
commit
6c9f1ad06b
23 changed files with 574 additions and 5 deletions
19
src/app/api/share/[shareId]/route.ts
Normal file
19
src/app/api/share/[shareId]/route.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import { json, notFound } from 'lib/response';
|
||||
import { getSharedWebsite } from 'queries';
|
||||
import { createToken } from 'next-basics';
|
||||
import { secret } from 'lib/crypto';
|
||||
|
||||
export async function GET(request: Request, { params }: { params: Promise<{ shareId: string }> }) {
|
||||
const { shareId } = await params;
|
||||
|
||||
const website = await getSharedWebsite(shareId);
|
||||
|
||||
if (!website) {
|
||||
return notFound();
|
||||
}
|
||||
|
||||
const data = { websiteId: website.id };
|
||||
const token = createToken(data, secret());
|
||||
|
||||
return json({ ...data, token });
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue