Skip to content

Commit 695fe68

Browse files
committed
2 parents f62fea6 + 59f5a6d commit 695fe68

File tree

4 files changed

+13575
-8146
lines changed

4 files changed

+13575
-8146
lines changed

lib/sponsor/email-service.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@ import { Resend } from 'resend'
22

33
const FROM_EMAIL = 'Alex Patterson <alex@codingcat.dev>'
44

5+
/** Lazy Resend client — only created when actually needed (avoids build-time crash) */
6+
let _resend: Resend | null = null
7+
function getResendClient(): Resend {
8+
if (!_resend) {
9+
_resend = new Resend(process.env.RESEND_API_KEY)
10+
}
11+
return _resend
12+
}
13+
514
/**
615
* Send a sponsor-related email via Resend.
716
* Falls back to console logging if RESEND_API_KEY is not set.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"@sanity/image-url": "^2.0.3",
5858
"@sanity/preview-url-secret": "^4.0.3",
5959
"@sanity/studio-secrets": "^4.0.1",
60+
"@sanity/table": "^2.0.1",
6061
"@sanity/ui": "^3.1.13",
6162
"@sanity/vision": "^5.12.0",
6263
"@sanity/webhook": "^4.0.4",

0 commit comments

Comments
 (0)