import { query } from "@/lib/db" import { redirect } from "next/navigation" interface Props { params: Promise<{ token: string }> } function ErrorPage({ message }: { message: string }) { return (

{message}

) } export default async function JoinPage({ params }: Props) { const { token } = await params const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i if (UUID_REGEX.test(token)) { redirect(`/call/${token}`) } const result = await query( `SELECT phone, created_at, expires_at FROM invites WHERE token = $1 LIMIT 1`, [token], ) if (result.rows.length === 0) { return } const invite = result.rows[0] if (new Date(invite.expires_at) <= new Date()) { return } return (

You're Invited!

Someone wants to connect with you on our platform.

Contact Number

{invite.phone}

Create an account to start making free voice calls to this person and others on the platform.

Create Account
) }