fix: duplicate Invite Issue (#96)
* fix: Duplicate Invite Issues. * fix: Resolved Changes Needed.
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user