import { internal } from "@app/lib/api"; import { authCookieHeader } from "@app/lib/api/cookies"; import { verifySession } from "@app/lib/auth/verifySession"; import { AcceptInviteResponse } from "@server/routers/user"; import { AxiosResponse } from "axios"; import { redirect } from "next/navigation"; import InviteStatusCard from "./InviteStatusCard"; import { formatAxiosError } from "@app/lib/api";; export default async function InvitePage(props: { searchParams: Promise<{ [key: string]: string | string[] | undefined }>; }) { const params = await props.searchParams; const tokenParam = params.token as string; if (!tokenParam) { redirect("/"); } const user = await verifySession(); const parts = tokenParam.split("-"); if (parts.length !== 2) { return ( <>
The invite link is invalid.
> ); } const inviteId = parts[0]; const token = parts[1]; let error = ""; const res = await internal .post