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

@ -58,7 +58,6 @@
<script>
import auth from '../../auth'
import router from '../../router'
import message from '../../message'
import manageSharing from '../sharing/userTeam'
import NamespaceService from '../../services/namespace'
@ -111,7 +110,7 @@
this.manageUsersComponent = 'manageSharing'
})
.catch(e => {
message.error(e, this)
this.error(e, this)
})
},
submit() {
@ -124,20 +123,20 @@
this.$set(this.$parent.namespaces, n, r)
}
}
message.success({message: 'The namespace was successfully updated.'}, this)
this.success({message: 'The namespace was successfully updated.'}, this)
})
.catch(e => {
message.error(e, this)
this.error(e, this)
})
},
deleteNamespace() {
this.namespaceService.delete(this.namespace)
.then(() => {
message.success({message: 'The namespace was successfully deleted.'}, this)
this.success({message: 'The namespace was successfully deleted.'}, this)
router.push({name: 'home'})
})
.catch(e => {
message.error(e, this)
this.error(e, this)
})
}
}

View File

@ -27,7 +27,6 @@
<script>
import auth from '../../auth'
import router from '../../router'
import message from '../../message'
import NamespaceModel from "../../models/namespace";
import NamespaceService from "../../services/namespace";
@ -55,11 +54,11 @@
this.namespaceService.create(this.namespace)
.then(() => {
this.$parent.loadNamespaces()
message.success({message: 'The namespace was successfully created.'}, this)
this.success({message: 'The namespace was successfully created.'}, this)
router.push({name: 'home'})
})
.catch(e => {
message.error(e, this)
this.error(e, this)
})
},
back() {