Skip to content

Commit

Permalink
fix(MemberPicker): Show success/error notifications on member actions
Browse files Browse the repository at this point in the history
Signed-off-by: Jonas <[email protected]>
  • Loading branch information
mejo- committed Jul 27, 2023
1 parent ce7140b commit b75ff18
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/components/Member/Member.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@

<script>
import { mapActions } from 'vuex'
import { showError, showSuccess } from '@nextcloud/dialogs'
import { circlesMemberTypes, memberLevels } from '../../constants.js'
import {
GET_CIRCLE_MEMBERS,
Expand Down Expand Up @@ -207,16 +208,31 @@ export default {
if (this.circleId) {
this.isLoadingLevel = true
await this.dispatchChangeCircleMemberLevel({ circleId: this.circleId, memberId: this.memberId, level })
await this.dispatchGetCircleMembers(this.circleId)
this.isLoadingLevel = false
.then(async () => {
showSuccess(t('collectives', 'Member level changed'))
await this.dispatchGetCircleMembers(this.circleId)
}).catch((error) => {
showError(t('collectives', 'Could not change member level'))
throw error
}).finally(() => {
this.isLoadingLevel = false
})
}
},
async removeMember() {
if (this.circleId) {
this.isLoadingLevel = true
await this.dispatchRemoveMemberFromCircle({ circleId: this.circleId, memberId: this.memberId })
await this.dispatchGetCircleMembers(this.circleId)
.then(async () => {
showSuccess(t('collectives', 'Member removed'))
await this.dispatchGetCircleMembers(this.circleId)
}).catch((error) => {
showError(t('collectives', 'Could not remove member'))
throw error
}).finally(() => {
this.isLoadingLevel = false
})
this.isLoadingLevel = false
}
},
Expand Down

0 comments on commit b75ff18

Please sign in to comment.