fix: duplicate Invite Issue (#96)

* fix: Duplicate Invite Issues.

* fix: Resolved Changes Needed.
This commit is contained in:
Rohit Chaware
2023-12-11 05:47:41 +03:00
committed by GitHub
parent 28e9281fdc
commit 4c3a5e93e6
@@ -38,7 +38,15 @@
let apiError = ''; let apiError = '';
emails.forEach(async (email, index) => { emails.forEach(async (email, index) => {
if (apiError) return; if (apiError) return;
const { data, error } = await supabase
const doesEmailExist = $orgTeam.some(teamMember => teamMember.email.toLowerCase() === email.toLowerCase())
if (doesEmailExist) {
snackbar.error("User Already Exists");
isLoading = false;
return;
} else {
const { data, error } = await supabase
.from('organizationmember') .from('organizationmember')
.insert({ .insert({
organization_id: $currentOrg.id, organization_id: $currentOrg.id,
@@ -47,7 +55,8 @@
verified: false verified: false
}) })
.select(); .select();
console.log('data', data); console.log('data', data);
}
if (error) { if (error) {
apiError = error; apiError = error;