Skip to content

Commit

Permalink
fix: Show failure message only on error
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Ng <[email protected]>
  • Loading branch information
Pytal committed Jun 13, 2024
1 parent 7c56aba commit 6ba7f33
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/TransferGuestDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export default defineComponent({
})
this.$emit('close', this.userId)
} catch (error) {
this.$emit('close', null)
this.$emit('close', false)
}
this.loading = false
},
Expand Down
7 changes: 5 additions & 2 deletions src/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ import SvgAccountArrowRight from '@mdi/svg/svg/account-arrow-right.svg?raw'
import TransferGuestDialog from './components/TransferGuestDialog.vue'

const transferGuest = (_event: MouseEvent, user: User): void => {
const onClose = (userId: null | string) => {
if (!userId) {
const onClose = (userId: false | null | string) => {
if (userId === false) {
showError(t('guests', 'Failed to transfer guest'))
return
}
if (userId === null) { // Transfer is cancelled so we return silently
return
}
showSuccess(t('guests', 'Guest transferred to new account "{userId}"', { userId }))
emit('guests:user:deleted', user.id as string)
emit('guests:user:created', userId)
Expand Down

0 comments on commit 6ba7f33

Please sign in to comment.