Converted reports and share routes.

This commit is contained in:
Mike Cao 2025-01-28 10:21:56 -08:00
parent dcac7b7c96
commit 6c9f1ad06b
23 changed files with 574 additions and 5 deletions

View 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 });
}