1
0

Refactor success and error messages

This commit is contained in:
kolaente
2021-06-22 22:07:57 +02:00
parent ab4edc17de
commit cdc805c8da
55 changed files with 219 additions and 256 deletions

View File

@ -69,17 +69,14 @@ export default {
this.$store
.dispatch('lists/createList', this.list)
.then((r) => {
this.success(
{ message: 'The list was successfully created.' },
this
)
this.success({message: 'The list was successfully created.'})
this.$router.push({
name: 'list.index',
params: { listId: r.id },
})
})
.catch((e) => {
this.error(e, this)
this.error(e)
})
},
},

View File

@ -142,7 +142,7 @@ export default {
this.$store.commit(CURRENT_LIST, r)
})
.catch(e => {
this.error(e, this)
this.error(e)
})
.finally(() => {
this.listLoaded = this.$route.params.listId

View File

@ -38,10 +38,10 @@ export default {
.then(r => {
this.$store.commit('currentList', r)
this.$store.commit('namespaces/setListInNamespaceById', r)
this.success({message: 'The list was successfully archived.'}, this)
this.success({message: 'The list was successfully archived.'})
})
.catch(e => {
this.error(e, this)
this.error(e)
})
.finally(() => {
this.$router.back()

View File

@ -130,7 +130,7 @@ export default {
})
})
.catch(e => {
this.error(e, this)
this.error(e)
})
}, 300)
},
@ -144,10 +144,10 @@ export default {
.then(l => {
this.$store.commit(CURRENT_LIST, l)
this.$store.commit('namespaces/setListInNamespaceById', l)
this.success({message: 'The background has been set successfully!'}, this)
this.success({message: 'The background has been set successfully!'})
})
.catch(e => {
this.error(e, this)
this.error(e)
})
},
uploadBackground() {
@ -159,10 +159,10 @@ export default {
.then(l => {
this.$store.commit(CURRENT_LIST, l)
this.$store.commit('namespaces/setListInNamespaceById', l)
this.success({message: 'The background has been set successfully!'}, this)
this.success({message: 'The background has been set successfully!'})
})
.catch(e => {
this.error(e, this)
this.error(e)
})
},
removeBackground() {
@ -170,11 +170,11 @@ export default {
.then(l => {
this.$store.commit(CURRENT_LIST, l)
this.$store.commit('namespaces/setListInNamespaceById', l)
this.success({message: 'The background has been removed successfully!'}, this)
this.success({message: 'The background has been removed successfully!'})
this.$router.back()
})
.catch(e => {
this.error(e, this)
this.error(e)
})
},
},

View File

@ -31,11 +31,11 @@ export default {
this.listService.delete(list)
.then(() => {
this.$store.commit('namespaces/removeListFromNamespaceById', list)
this.success({message: 'The list was successfully deleted.'}, this)
this.success({message: 'The list was successfully deleted.'})
this.$router.push({name: 'home'})
})
.catch(e => {
this.error(e, this)
this.error(e)
})
},
},

View File

@ -46,11 +46,11 @@ export default {
.then(r => {
this.$store.commit('namespaces/addListToNamespace', r.list)
this.$store.commit('lists/setList', r.list)
this.success({message: 'The list was successfully duplicated.'}, this)
this.success({message: 'The list was successfully duplicated.'})
this.$router.push({name: 'list.index', params: {listId: r.list.id}})
})
.catch(e => {
this.error(e, this)
this.error(e)
})
},
},

View File

@ -109,17 +109,17 @@ export default {
this.setTitle(`Edit "${this.list.title}"`)
})
.catch(e => {
this.error(e, this)
this.error(e)
})
},
save() {
this.$store.dispatch('lists/updateList', this.list)
.then(() => {
this.success({message: 'The list was successfully updated.'}, this)
this.success({message: 'The list was successfully updated.'})
this.$router.back()
})
.catch(e => {
this.error(e, this)
this.error(e)
})
},
},

View File

@ -70,7 +70,7 @@ export default {
this.setTitle(`Share "${this.list.title}"`)
})
.catch(e => {
this.error(e, this)
this.error(e)
})
},
},

View File

@ -387,14 +387,14 @@ export default {
bucketId: b.id,
})
.catch(e => {
this.error(e, this)
this.error(e)
})
}
})
})
})
.catch(e => {
this.error(e, this)
this.error(e)
})
},
onDrop(bucketId, dropResult) {
@ -449,7 +449,7 @@ export default {
this.$store.dispatch('tasks/update', task)
.catch(e => {
this.error(e, this)
this.error(e)
})
.finally(() => {
this.$set(this.taskUpdating, task.id, false)
@ -468,7 +468,7 @@ export default {
}
})
.catch(e => {
this.error(e, this)
this.error(e)
})
.finally(() => {
this.$set(this.taskUpdating, task.id, false)
@ -516,7 +516,7 @@ export default {
this.$store.commit('kanban/addTaskToBucket', r)
})
.catch(e => {
this.error(e, this)
this.error(e)
})
.finally(() => {
if (!this.$refs[`tasks-container${task.bucketId}`][0]) {
@ -541,7 +541,7 @@ export default {
this.showNewBucketInput = false
})
.catch(e => {
this.error(e, this)
this.error(e)
})
},
deleteBucketModal(bucketId) {
@ -560,10 +560,10 @@ export default {
this.$store.dispatch('kanban/deleteBucket', {bucket: bucket, params: this.params})
.then(() => {
this.success({message: 'The bucket has been deleted successfully.'}, this)
this.success({message: 'The bucket has been deleted successfully.'})
})
.catch(e => {
this.error(e, this)
this.error(e)
})
.finally(() => {
this.showBucketDeleteModal = false
@ -590,20 +590,20 @@ export default {
.then(r => {
realBucket.title = r.title
bucketTitleElement.blur()
this.success({message: 'The bucket title has been saved successfully.'}, this)
this.success({message: 'The bucket title has been saved successfully.'})
})
.catch(e => {
this.error(e, this)
this.error(e)
})
},
updateBucket(bucket) {
bucket.limit = parseInt(bucket.limit)
this.$store.dispatch('kanban/updateBucket', bucket)
.then(() => {
this.success({message: 'The bucket limit been saved successfully.'}, this)
this.success({message: 'The bucket limit been saved successfully.'})
})
.catch(e => {
this.error(e, this)
this.error(e)
})
},
setBucketLimit(bucket) {
@ -622,10 +622,10 @@ export default {
bucket.isDoneBucket = !bucket.isDoneBucket
this.$store.dispatch('kanban/updateBucket', bucket)
.then(() => {
this.success({message: 'The done bucket has been saved successfully.'}, this)
this.success({message: 'The done bucket has been saved successfully.'})
})
.catch(e => {
this.error(e, this)
this.error(e)
bucket.isDoneBucket = !bucket.isDoneBucket
})
},

View File

@ -323,7 +323,7 @@ export default {
labelAddings[index - 1].resolve(result)
})
.catch(e => {
this.error(e, this)
this.error(e)
})
} else {
// label not found, create it
@ -345,11 +345,11 @@ export default {
labelAddings[index - 1].resolve(result)
})
.catch(e => {
this.error(e, this)
this.error(e)
})
})
.catch(e => {
this.error(e, this)
this.error(e)
})
}
})
@ -365,13 +365,13 @@ export default {
this.$store.commit(HAS_TASKS, true)
})
.catch(e => {
this.error(e, this)
this.error(e)
})
})
}
})
.catch(e => {
this.error(e, this)
this.error(e)
})
},
editTask(id) {