Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User settings/teams - removeUser mutation error handling #1094

Merged
merged 3 commits into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

### Bugfixes

- Adds a try/catch block when deleting a membership in the removeUser method - [#1094](https://github.com/PrefectHQ/ui/pull/1094)

- Internal: update CircleCI config slack orb (add `@` to mentions) - [#1053](https://github.com/PrefectHQ/ui/pull/1053)
- Disable start run button for late flow runs -[#1087](https://github.com/PrefectHQ/ui/pull/1087)
- Filter by scheduled runs in the Flow runs table - [#1079](https://github.com/PrefectHQ/ui/pull/1079)
Expand Down
32 changes: 19 additions & 13 deletions src/pages/UserSettings/Teams.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,20 +142,26 @@ export default {
await this.setCurrentTenant(removalTenant.slug)
}

const res = await this.$apollo.mutate({
mutation: require('@/graphql/Tenant/delete-membership.gql'),
variables: { membershipId }
})
let success

if (res?.data?.delete_membership?.success) {
this.$emit(
'successful-action',
'You have removed yourself from this team.'
)
} else {
this.$emit(
'failed-action',
'Something went wrong while trying to leave this team. Please try again.'
try {
await this.$apollo.mutate({
mutation: require('@/graphql/Tenant/delete-membership.gql'),
variables: { membershipId }
})
success = true
} catch (e) {
success = false
} finally {
this.setAlert(
{
alertShow: true,
alertMessage: success
? 'You have removed yourself from this team.'
: 'Something went wrong while trying to leave this team. Please try again.',
alertType: success ? 'success' : 'error'
},
3000
)
}

Expand Down