mirror of
https://github.com/hanzo-apps/dataroom.git
synced 2026-10-30 14:47:36 +00:00
21 lines
545 B
TypeScript
21 lines
545 B
TypeScript
import { get } from "@vercel/edge-config";
|
|
|
|
export const isTrustedTeam = async (teamId: string): Promise<boolean> => {
|
|
if (!process.env.EDGE_CONFIG) {
|
|
return false;
|
|
}
|
|
|
|
let trustedTeams: string[] = [];
|
|
try {
|
|
const result = await get("trustedTeams");
|
|
trustedTeams = Array.isArray(result)
|
|
? result.filter((item): item is string => typeof item === "string")
|
|
: [];
|
|
} catch (e) {
|
|
// Already initialized as empty array
|
|
}
|
|
|
|
if (trustedTeams.length === 0) return false;
|
|
return trustedTeams.includes(teamId);
|
|
};
|