55 lines
938 B
TypeScript
55 lines
938 B
TypeScript
|
|
import type { Metadata } from 'next';
|
||
|
|
import { notFound } from 'next/navigation';
|
||
|
|
|
||
|
|
import { findSessionByAlias } from '@/lib/proofSessions';
|
||
|
|
import {
|
||
|
|
proofMetadata,
|
||
|
|
renderProof,
|
||
|
|
} from '../../proof/renderProof';
|
||
|
|
|
||
|
|
|
||
|
|
export const dynamic = 'force-dynamic';
|
||
|
|
|
||
|
|
|
||
|
|
interface ClientPageProps {
|
||
|
|
params: Promise<{
|
||
|
|
alias: string;
|
||
|
|
}>;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
export async function generateMetadata({
|
||
|
|
params,
|
||
|
|
}: ClientPageProps): Promise<Metadata> {
|
||
|
|
const { alias } = await params;
|
||
|
|
|
||
|
|
const session = await findSessionByAlias(alias);
|
||
|
|
|
||
|
|
if (!session) {
|
||
|
|
return {
|
||
|
|
title: 'Not found',
|
||
|
|
robots: {
|
||
|
|
index: false,
|
||
|
|
follow: false,
|
||
|
|
},
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
return proofMetadata(session.token);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
export default async function ClientPage({
|
||
|
|
params,
|
||
|
|
}: ClientPageProps) {
|
||
|
|
const { alias } = await params;
|
||
|
|
|
||
|
|
const session = await findSessionByAlias(alias);
|
||
|
|
|
||
|
|
if (!session) {
|
||
|
|
notFound();
|
||
|
|
}
|
||
|
|
|
||
|
|
return renderProof(session.token);
|
||
|
|
}
|