Openstatus www.openstatus.dev
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 33 lines 908 B view raw
1import { getQueryClient, trpc } from "@/lib/trpc/server"; 2import { EmailClient } from "@openstatus/emails"; 3import Resend from "next-auth/providers/resend"; 4import { getValidCustomDomain } from "../domain"; 5 6export const ResendProvider = Resend({ 7 apiKey: undefined, 8 async sendVerificationRequest(params) { 9 const url = params.url; 10 const email = params.identifier; 11 12 const emailClient = new EmailClient({ 13 apiKey: process.env.RESEND_API_KEY ?? "", 14 }); 15 16 const { prefix } = getValidCustomDomain(params.request); 17 18 if (!prefix) return; 19 20 const queryClient = getQueryClient(); 21 const query = await queryClient.fetchQuery( 22 trpc.statusPage.validateEmailDomain.queryOptions({ slug: prefix, email }), 23 ); 24 25 if (!query) return; 26 27 await emailClient.sendStatusPageMagicLink({ 28 page: query.page.title, 29 link: url, 30 to: params.identifier, 31 }); 32 }, 33});