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

@ -150,10 +150,10 @@ export default {
.then((r) => {
this.$set(this, 'taskEditTask', r)
this.initTaskFields()
this.success({message: 'The task has been saved successfully.'}, this)
this.success({message: 'The task has been saved successfully.'})
})
.catch((e) => {
this.error(e, this)
this.error(e)
})
},
},

View File

@ -362,7 +362,7 @@ export default {
})
})
.catch((e) => {
this.error(e, this)
this.error(e)
})
},
addGantAttributes(t) {
@ -447,7 +447,7 @@ export default {
}
})
.catch((e) => {
this.error(e, this)
this.error(e)
})
},
editTask(task) {
@ -484,7 +484,7 @@ export default {
this.hideCrateNewTask()
})
.catch((e) => {
this.error(e, this)
this.error(e)
})
},
},

View File

@ -31,7 +31,7 @@ export default {
}
})
.catch(e => {
this.error(e, this)
this.error(e)
})
},
},

View File

@ -115,7 +115,7 @@ export default {
this.loadedList = cloneDeep(currentList)
})
.catch(e => {
this.error(e, this)
this.error(e)
})
},
loadTasksForPage(e) {

View File

@ -226,10 +226,10 @@ export default {
'attachments/removeById',
this.attachmentToDelete.id
)
this.success(r, this)
this.success(r)
})
.catch((e) => {
this.error(e, this)
this.error(e)
})
.finally(() => {
this.showDeleteModal = false

View File

@ -236,7 +236,7 @@ export default {
this.makeActions()
})
.catch((e) => {
this.error(e, this)
this.error(e)
})
},
addComment() {
@ -258,13 +258,10 @@ export default {
.then((r) => {
this.comments.push(r)
this.newComment.comment = ''
this.success(
{message: 'The comment was added successfully.'},
this
)
this.success({message: 'The comment was added successfully.'})
})
.catch((e) => {
this.error(e, this)
this.error(e)
})
.finally(() => {
this.creating = false
@ -300,7 +297,7 @@ export default {
}, 2000)
})
.catch((e) => {
this.error(e, this)
this.error(e)
})
.finally(() => {
this.isCommentEdit = false
@ -318,7 +315,7 @@ export default {
}
})
.catch((e) => {
this.error(e, this)
this.error(e)
})
.finally(() => {
this.showDeleteModal = false

View File

@ -131,7 +131,7 @@ export default {
this.$emit('input', r)
})
.catch((e) => {
this.error(e, this)
this.error(e)
})
},
},

View File

@ -86,7 +86,7 @@ export default {
}, 2000)
})
.catch(e => {
this.error(e, this)
this.error(e)
})
.finally(() => {
this.saving = false

View File

@ -84,10 +84,10 @@ export default {
this.$store.dispatch('tasks/addAssignee', {user: user, taskId: this.taskId})
.then(() => {
this.$emit('input', this.assignees)
this.success({message: 'The user has been assigned successfully.'}, this)
this.success({message: 'The user has been assigned successfully.'})
})
.catch(e => {
this.error(e, this)
this.error(e)
})
},
removeAssignee(user) {
@ -99,10 +99,10 @@ export default {
this.assignees.splice(a, 1)
}
}
this.success({message: 'The user has been unassinged successfully.'}, this)
this.success({message: 'The user has been unassinged successfully.'})
})
.catch(e => {
this.error(e, this)
this.error(e)
})
},
findUser(query) {
@ -119,7 +119,7 @@ export default {
}))
})
.catch(e => {
this.error(e, this)
this.error(e)
})
},
clearAllFoundUsers() {

View File

@ -104,11 +104,11 @@ export default {
.then(() => {
this.$emit('input', this.labels)
if (showNotification) {
this.success({message: 'The label has been added successfully.'}, this)
this.success({message: 'The label has been added successfully.'})
}
})
.catch(e => {
this.error(e, this)
this.error(e)
})
},
removeLabel(label) {
@ -121,10 +121,10 @@ export default {
}
}
this.$emit('input', this.labels)
this.success({message: 'The label has been removed successfully.'}, this)
this.success({message: 'The label has been removed successfully.'})
})
.catch(e => {
this.error(e, this)
this.error(e)
})
},
createAndAddLabel(title) {
@ -133,10 +133,10 @@ export default {
.then(r => {
this.addLabel(r, false)
this.labels.push(r)
this.success({message: 'The label has been created successfully.'}, this)
this.success({message: 'The label has been created successfully.'})
})
.catch(e => {
this.error(e, this)
this.error(e)
})
},

View File

@ -90,7 +90,7 @@ export default {
}, 2000)
})
.catch(e => {
this.error(e, this)
this.error(e)
})
.finally(() => {
this.saving = false

View File

@ -51,7 +51,7 @@ export default {
this.$set(this, 'foundLists', response)
})
.catch(e => {
this.error(e, this)
this.error(e)
})
},
clearAll() {

View File

@ -192,7 +192,7 @@ export default {
this.$set(this, 'foundTasks', response)
})
.catch(e => {
this.error(e, this)
this.error(e)
})
},
addTaskRelation() {
@ -215,7 +215,7 @@ export default {
}, 2000)
})
.catch(e => {
this.error(e, this)
this.error(e)
})
},
removeTaskRelation() {
@ -239,7 +239,7 @@ export default {
}, 2000)
})
.catch(e => {
this.error(e, this)
this.error(e)
})
.finally(() => {
this.showDeleteModal = false
@ -253,7 +253,7 @@ export default {
this.addTaskRelation()
})
.catch(e => {
this.error(e, this)
this.error(e)
})
},
relationKindTitle(kind, length) {

View File

@ -175,20 +175,16 @@ export default {
}
this.task = t
this.$emit('task-updated', t)
this.success(
{message: 'The task was successfully ' + (this.task.done ? '' : 'un-') + 'marked as done.'},
this,
[{
title: 'Undo',
callback: () => {
this.task.done = !this.task.done
this.markAsDone(!checked)
}
}],
)
this.success({message: 'The task was successfully ' + (this.task.done ? '' : 'un-') + 'marked as done.'}, [{
title: 'Undo',
callback: () => {
this.task.done = !this.task.done
this.markAsDone(!checked)
}
}])
})
.catch(e => {
this.error(e, this)
this.error(e)
})
}
@ -207,7 +203,7 @@ export default {
this.$store.dispatch('namespaces/loadNamespacesIfFavoritesDontExist')
})
.catch(e => {
this.error(e, this)
this.error(e)
})
},
hideDeferDueDatePopup(e) {