1
0

Use message mixin for handling success and error messages (#51)

Use message mixin everywhere

Add mixin for success and error messages

Co-authored-by: kolaente <k@knt.li>
Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/51
This commit is contained in:
konrad
2020-01-30 21:47:08 +00:00
parent a0c4732f81
commit 1170e030f6
25 changed files with 94 additions and 116 deletions

View File

@ -137,7 +137,6 @@
<script>
import auth from '../../auth'
import router from '../../router'
import message from '../../message'
import TeamService from '../../services/team'
import TeamModel from '../../models/team'
@ -190,37 +189,37 @@
}
})
.catch(e => {
message.error(e, this)
this.error(e, this)
})
},
submit() {
this.teamService.update(this.team)
.then(response => {
this.team = response
message.success({message: 'The team was successfully updated.'}, this)
this.success({message: 'The team was successfully updated.'}, this)
})
.catch(e => {
message.error(e, this)
this.error(e, this)
})
},
deleteTeam() {
this.teamService.delete(this.team)
.then(() => {
message.success({message: 'The team was successfully deleted.'}, this)
this.success({message: 'The team was successfully deleted.'}, this)
router.push({name: 'listTeams'})
})
.catch(e => {
message.error(e, this)
this.error(e, this)
})
},
deleteUser() {
this.teamMemberService.delete(this.member)
.then(() => {
message.success({message: 'The user was successfully deleted from the team.'}, this)
this.success({message: 'The user was successfully deleted from the team.'}, this)
this.loadTeam()
})
.catch(e => {
message.error(e, this)
this.error(e, this)
})
.finally(() => {
this.showUserDeleteModal = false
@ -230,10 +229,10 @@
this.teamMemberService.create(this.member)
.then(() => {
this.loadTeam()
message.success({message: 'The team member was successfully added.'}, this)
this.success({message: 'The team member was successfully added.'}, this)
})
.catch(e => {
message.error(e, this)
this.error(e, this)
})
},
toggleUserType(member) {

View File

@ -20,7 +20,6 @@
<script>
import auth from '../../auth'
import router from '../../router'
import message from '../../message'
import TeamService from '../../services/team'
export default {
@ -48,7 +47,7 @@
this.$set(this, 'teams', response)
})
.catch(e => {
message.error(e, this)
this.error(e, this)
})
},
}

View File

@ -26,7 +26,6 @@
<script>
import auth from '../../auth'
import router from '../../router'
import message from '../../message'
import TeamModel from '../../models/team'
import TeamService from '../../services/team'
@ -54,10 +53,10 @@
this.teamService.create(this.team)
.then(response => {
router.push({name:'editTeam', params:{id: response.id}})
message.success({message: 'The team was successfully created.'}, this)
this.success({message: 'The team was successfully created.'}, this)
})
.catch(e => {
message.error(e, this)
this.error(e, this)
})
},
back() {