fix: admin dashboard bugs (#74)
This commit is contained in:
committed by
GitHub
parent
a33337ae0c
commit
e54f837b83
@@ -120,7 +120,7 @@
|
||||
</div>
|
||||
|
||||
<div v-if="team" class="sm:px-6 px-4">
|
||||
<TeamsMembers v-if="showMembers" />
|
||||
<TeamsMembers v-if="showMembers" @updateTeam="updateTeam()" />
|
||||
<TeamsPendingInvites v-if="showPendingInvites" :editingTeamID="team.id" />
|
||||
<HoppSmartConfirmModal
|
||||
:show="confirmDeletion"
|
||||
@@ -193,9 +193,8 @@ const getTeamInfo = async () => {
|
||||
fetching.value = false;
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
await getTeamInfo();
|
||||
});
|
||||
onMounted(async () => await getTeamInfo());
|
||||
const updateTeam = async () => await getTeamInfo();
|
||||
|
||||
// Rename the team name
|
||||
const showRenameInput = ref(false);
|
||||
|
||||
@@ -245,22 +245,31 @@ const showCreateTeamModal = ref(false);
|
||||
const getOwnerEmail = (email: string) => (ownerEmail.value = email);
|
||||
|
||||
const createTeam = async () => {
|
||||
if (teamName.value.length < 6) {
|
||||
toast.error('Team name should be atleast 6 characters long!!');
|
||||
return;
|
||||
}
|
||||
if (ownerEmail.value.length == 0) {
|
||||
toast.error('Please enter email of team owner!!');
|
||||
return;
|
||||
}
|
||||
const userUid =
|
||||
usersList.value.find((user) => user.email === ownerEmail.value)?.uid || '';
|
||||
const variables = { name: teamName.value.trim(), userUid: userUid };
|
||||
await createTeamMutation.executeMutation(variables).then((result) => {
|
||||
if (result.error) {
|
||||
if (teamName.value.length < 6) {
|
||||
toast.error('Team name should be atleast 6 characters long!!');
|
||||
}
|
||||
if (result.error.toString() == '[GraphQL] user/not_found') {
|
||||
toast.error('User not found!!');
|
||||
} else {
|
||||
toast.error('Failed to create team!!');
|
||||
}
|
||||
teamName.value = '';
|
||||
ownerEmail.value = '';
|
||||
} else {
|
||||
toast.success('Team created successfully!!');
|
||||
showCreateTeamModal.value = false;
|
||||
teamName.value = '';
|
||||
ownerEmail.value = '';
|
||||
refetch();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user