/** * Tells the register page whether an invite link still works and who it is * from. Public on purpose, the person opening the link has no account yet. */ export default defineEventHandler(async (event) => { const invite = await findUsableInvite(getRouterParam(event, 'token')!); if (!invite) { return { valid: false as const }; } return { valid: true as const, expiresAt: invite.expiresAt, singleUse: invite.maxUses === 1, inviter: { id: invite.inviterId, name: invite.inviterName, image: invite.inviterImage, }, }; });