fix: loading state
This commit is contained in:
@@ -89,7 +89,8 @@
|
|||||||
:title="t('action.remove')"
|
:title="t('action.remove')"
|
||||||
svg="trash"
|
svg="trash"
|
||||||
color="red"
|
color="red"
|
||||||
@click.native="removeInvitee(invitee.id)"
|
:loading="isLoadingIndex === index"
|
||||||
|
@click.native="removeInvitee(invitee.id, index)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -372,6 +373,7 @@ const pendingInvites = useGQLQuery<
|
|||||||
variables: reactive({
|
variables: reactive({
|
||||||
teamID: props.editingTeamID,
|
teamID: props.editingTeamID,
|
||||||
}),
|
}),
|
||||||
|
pollDuration: 10000,
|
||||||
updateSubs: computed(() =>
|
updateSubs: computed(() =>
|
||||||
!props.editingTeamID
|
!props.editingTeamID
|
||||||
? []
|
? []
|
||||||
@@ -395,6 +397,17 @@ const pendingInvites = useGQLQuery<
|
|||||||
defer: true,
|
defer: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.show,
|
||||||
|
(show) => {
|
||||||
|
if (!show) {
|
||||||
|
pendingInvites.pause()
|
||||||
|
} else {
|
||||||
|
pendingInvites.unpause()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.editingTeamID,
|
() => props.editingTeamID,
|
||||||
() => {
|
() => {
|
||||||
@@ -406,13 +419,17 @@ watch(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
const removeInvitee = async (id: string) => {
|
const isLoadingIndex = ref<null | number>(null)
|
||||||
|
|
||||||
|
const removeInvitee = async (id: string, index: number) => {
|
||||||
|
isLoadingIndex.value = index
|
||||||
const result = await revokeTeamInvitation(id)()
|
const result = await revokeTeamInvitation(id)()
|
||||||
if (E.isLeft(result)) {
|
if (E.isLeft(result)) {
|
||||||
toast.error(`${t("error.something_went_wrong")}`)
|
toast.error(`${t("error.something_went_wrong")}`)
|
||||||
} else {
|
} else {
|
||||||
toast.success(`${t("team.member_removed")}`)
|
toast.success(`${t("team.member_removed")}`)
|
||||||
}
|
}
|
||||||
|
isLoadingIndex.value = null
|
||||||
}
|
}
|
||||||
|
|
||||||
const newInvites = ref<Array<{ key: string; value: TeamMemberRole }>>([
|
const newInvites = ref<Array<{ key: string; value: TeamMemberRole }>>([
|
||||||
|
|||||||
Reference in New Issue
Block a user