fix: Resolve issue with email domain environment variable not working

This commit is contained in:
sunny
2024-12-24 15:07:38 +08:00
parent dbea9e1de9
commit 35d5e75df2
2 changed files with 51 additions and 11 deletions

View File

@@ -0,0 +1,25 @@
import { EMAIL_CONFIG } from "@/config"
import { NextResponse } from "next/server"
export const runtime = "edge"
export async function GET() {
try {
const domains = EMAIL_CONFIG.DOMAINS
if (domains.length === 0) {
return NextResponse.json(
{ error: "无效的域名列表" },
{ status: 400 }
)
}
return NextResponse.json({ domains })
} catch (error) {
console.error('Failed to fetch domains:', error)
return NextResponse.json(
{ error: "获取域名列表失败" },
{ status: 500 }
)
}
}