mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
19 lines
544 B
TypeScript
19 lines
544 B
TypeScript
import { secret } from '@/lib/crypto';
|
|
import { createToken } from '@/lib/jwt';
|
|
import { json, notFound } from '@/lib/response';
|
|
import { getSharedWebsite } from '@/queries/prisma';
|
|
|
|
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 });
|
|
}
|