17 lines
494 B
TypeScript
17 lines
494 B
TypeScript
|
|
import { doc, getDoc } from "firebase/firestore";
|
||
|
|
import { db } from "../client/firebase";
|
||
|
|
|
||
|
|
|
||
|
|
export async function checkAllowAccess(userDomain: string): Promise<boolean> {
|
||
|
|
|
||
|
|
const docRef = doc(db, "whitelist", "allowedDomains");
|
||
|
|
const snapshot = await getDoc(docRef);
|
||
|
|
|
||
|
|
if(snapshot.exists()){
|
||
|
|
let domains = snapshot.data();
|
||
|
|
// console.log(`domains: ${JSON.stringify(domains)}`);
|
||
|
|
return domains["account_email"].includes(userDomain);
|
||
|
|
}
|
||
|
|
|
||
|
|
return false;
|
||
|
|
};
|