mirror of
https://github.com/hanzo-apps/dataroom.git
synced 2026-10-30 14:47:36 +00:00
24 lines
638 B
TypeScript
24 lines
638 B
TypeScript
import { get } from "@vercel/edge-config";
|
|
|
|
export const getCustomEmail = async (teamId?: string) => {
|
|
if (!process.env.EDGE_CONFIG || !teamId) {
|
|
return null;
|
|
}
|
|
|
|
let customEmails: Record<string, string | null> = {};
|
|
try {
|
|
const result = await get("customEmail");
|
|
// Make sure we get a valid object
|
|
customEmails =
|
|
typeof result === "object" && result !== null
|
|
? (result as Record<string, string | null>)
|
|
: {};
|
|
} catch (e) {
|
|
// Error getting custom emails, return null
|
|
return null;
|
|
}
|
|
|
|
// Return the custom email for the team if it exists
|
|
return customEmails[teamId] || null;
|
|
};
|