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:
@ -104,7 +104,6 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import message from '../../message'
|
||||
import rights from '../../models/rights'
|
||||
|
||||
import LinkShareService from '../../services/linkShare'
|
||||
@ -155,7 +154,7 @@
|
||||
this.linkShares = r
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(e, this)
|
||||
this.error(e, this)
|
||||
})
|
||||
},
|
||||
add() {
|
||||
@ -163,22 +162,22 @@
|
||||
this.linkShareService.create(newLinkShare)
|
||||
.then(() => {
|
||||
this.selectedRight = rights.READ
|
||||
message.success({message: 'The link share was successfully created'}, this)
|
||||
this.success({message: 'The link share was successfully created'}, this)
|
||||
this.load()
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(e, this)
|
||||
this.error(e, this)
|
||||
})
|
||||
},
|
||||
remove() {
|
||||
let linkshare = new LinkShareModel({id: this.linkIDToDelete, listID: this.listID})
|
||||
this.linkShareService.delete(linkshare)
|
||||
.then(() => {
|
||||
message.success({message: 'The link share was successfully deleted'}, this)
|
||||
this.success({message: 'The link share was successfully deleted'}, this)
|
||||
this.load()
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(e, this)
|
||||
this.error(e, this)
|
||||
})
|
||||
.finally(() => {
|
||||
this.showDeleteModal = false
|
||||
|
@ -11,7 +11,6 @@
|
||||
<script>
|
||||
import auth from '../../auth'
|
||||
import router from '../../router'
|
||||
import message from '../../message'
|
||||
|
||||
export default {
|
||||
name: 'linkSharingAuth',
|
||||
@ -32,7 +31,7 @@
|
||||
router.push({name: 'showList', params: {id: r.list_id}})
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(e, this)
|
||||
this.error(e, this)
|
||||
})
|
||||
}
|
||||
},
|
||||
|
@ -106,7 +106,6 @@
|
||||
|
||||
<script>
|
||||
import auth from '../../auth'
|
||||
import message from '../../message'
|
||||
import multiselect from 'vue-multiselect'
|
||||
|
||||
import UserNamespaceService from '../../services/userNamespace'
|
||||
@ -215,7 +214,7 @@
|
||||
this.$set(this, 'sharables', r)
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(e, this)
|
||||
this.error(e, this)
|
||||
})
|
||||
},
|
||||
deleteSharable() {
|
||||
@ -236,10 +235,10 @@
|
||||
this.sharables.splice(i, 1)
|
||||
}
|
||||
}
|
||||
message.success({message: 'The ' + this.shareType + ' was successfully deleted from the ' + this.typeString + '.'}, this)
|
||||
this.success({message: 'The ' + this.shareType + ' was successfully deleted from the ' + this.typeString + '.'}, this)
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(e, this)
|
||||
this.error(e, this)
|
||||
})
|
||||
},
|
||||
add(admin) {
|
||||
@ -259,11 +258,11 @@
|
||||
|
||||
this.stuffService.create(this.stuffModel)
|
||||
.then(() => {
|
||||
message.success({message: 'The ' + this.shareType + ' was successfully added.'}, this)
|
||||
this.success({message: 'The ' + this.shareType + ' was successfully added.'}, this)
|
||||
this.load()
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(e, this)
|
||||
this.error(e, this)
|
||||
})
|
||||
},
|
||||
toggleType() {
|
||||
@ -292,10 +291,10 @@
|
||||
this.$set(this.sharables[i], 'right', r.right)
|
||||
}
|
||||
}
|
||||
message.success({message: 'The ' + this.shareType + ' right was successfully updated.'}, this)
|
||||
this.success({message: 'The ' + this.shareType + ' right was successfully updated.'}, this)
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(e, this)
|
||||
this.error(e, this)
|
||||
})
|
||||
},
|
||||
find(query) {
|
||||
@ -309,7 +308,7 @@
|
||||
this.$set(this, 'found', response)
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(e, this)
|
||||
this.error(e, this)
|
||||
})
|
||||
},
|
||||
clearAll () {
|
||||
|
Reference in New Issue
Block a user