Converted reports and share routes.
This commit is contained in:
1 parent
dcac7b7c96
commit
6c9f1ad06b
23 files changed
+574
-5
No files matched your search
@@ -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 });
|
||||
}
|
||||
Reference in new issue
Block a user