Skip to content

Commit

Permalink
fix: error is no defined #97
Browse files Browse the repository at this point in the history
  • Loading branch information
rotimi-best committed Dec 11, 2023
1 parent f81a3fd commit 61d25b3
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions apps/dashboard/src/lib/components/Org/Settings/TeamMembers.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script>
<script lang="ts">
import { Grid, Row, Column, Select, SelectItem } from 'carbon-components-svelte';
import { Moon } from 'svelte-loading-spinners';
import TextField from '$lib/components/Form/TextField.svelte';
Expand All @@ -18,6 +18,7 @@
triggerSendEmail,
NOTIFICATION_NAME
} from '$lib/utils/services/notification/notification';
import type { OrgTeamMember } from '$lib/utils/types/org';
let emailsStr = '';
let errorMessage = '';
Expand All @@ -36,17 +37,19 @@
isLoading = true;
let apiError = '';
emails.forEach(async (email, index) => {
emails.forEach(async (email: string, index: number) => {
if (apiError) return;
const doesEmailExist = $orgTeam.some(teamMember => teamMember.email.toLowerCase() === email.toLowerCase())
const doesEmailExist = $orgTeam.some(
(teamMember) => teamMember.email.toLowerCase() === email.toLowerCase()
);
if (doesEmailExist) {
snackbar.error("User Already Exists");
snackbar.error('User Already Exists');
isLoading = false;
return;
} else {
const { data, error } = await supabase
}
const { data, error } = await supabase
.from('organizationmember')
.insert({
organization_id: $currentOrg.id,
Expand All @@ -55,11 +58,10 @@
verified: false
})
.select();
console.log('data', data);
}
console.log('data', data);
if (error) {
apiError = error;
apiError = `${error}`;
console.error('onSendInvite:', error);
snackbar.error(`Failed to send invite, please try again`);
Expand All @@ -72,6 +74,7 @@
{
id: newMember.id,
email: newMember?.email,
fullname: newMember?.fullname || '',
verified: newMember?.verified,
role: ROLE_LABEL[newMember?.role_id] || '',
isAdmin: newMember?.role_id === ROLE.ADMIN
Expand Down Expand Up @@ -99,7 +102,7 @@
});
}
async function onRemove(id) {
async function onRemove(id: number) {
console.log('onRemove called');
isRemoving = true;
const { data, error } = await supabase.from('organizationmember').delete().match({ id });
Expand All @@ -114,15 +117,15 @@
isRemoving = false;
}
const fetchTeam = async (id) => {
const fetchTeam = async (id: string) => {
if (!id) return;
isFetching = true;
await getOrgTeam(id);
isFetching = false;
};
const isTeamMemberAdmin = (members, profileId) => {
const isTeamMemberAdmin = (members: OrgTeamMember[], profileId: string | undefined) => {
return members.some((member) => member.profileId === profileId && member.isAdmin);
};
Expand Down

2 comments on commit 61d25b3

@vercel
Copy link

@vercel vercel bot commented on 61d25b3 Dec 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 61d25b3 Dec 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

landingpage – ./apps/classroomio-com

classroomio-com.vercel.app
landingpage-git-main-rotimi-best.vercel.app
landingpage-rotimi-best.vercel.app

Please sign in to comment.