Refactor success and error messages
This commit is contained in:
@ -130,7 +130,7 @@ export default {
|
||||
loadLabels() {
|
||||
this.$store.dispatch('labels/loadAllLabels')
|
||||
.catch(e => {
|
||||
this.error(e, this)
|
||||
this.error(e)
|
||||
})
|
||||
},
|
||||
},
|
||||
|
@ -161,7 +161,7 @@ export default {
|
||||
return
|
||||
}
|
||||
this.$store.dispatch('lists/toggleListFavorite', list)
|
||||
.catch(e => this.error(e, this))
|
||||
.catch(e => this.error(e))
|
||||
},
|
||||
resize() {
|
||||
// Hide the menu by default on mobile
|
||||
|
@ -490,7 +490,7 @@ export default {
|
||||
.then(r => {
|
||||
this.$set(this, kind, r)
|
||||
})
|
||||
.catch(e => this.error(e, this))
|
||||
.catch(e => this.error(e))
|
||||
}
|
||||
},
|
||||
setDoneFilter() {
|
||||
@ -545,7 +545,7 @@ export default {
|
||||
}))
|
||||
})
|
||||
.catch(e => {
|
||||
this.error(e, this)
|
||||
this.error(e)
|
||||
})
|
||||
},
|
||||
add(kind, filterName) {
|
||||
|
@ -105,7 +105,7 @@ export default {
|
||||
this.migrate()
|
||||
})
|
||||
.catch(e => {
|
||||
this.error(e, this)
|
||||
this.error(e)
|
||||
})
|
||||
}
|
||||
},
|
||||
@ -116,7 +116,7 @@ export default {
|
||||
this.authUrl = r.url
|
||||
})
|
||||
.catch(e => {
|
||||
this.error(e, this)
|
||||
this.error(e)
|
||||
})
|
||||
},
|
||||
migrate() {
|
||||
@ -129,7 +129,7 @@ export default {
|
||||
this.$store.dispatch('namespaces/loadNamespaces')
|
||||
})
|
||||
.catch(e => {
|
||||
this.error(e, this)
|
||||
this.error(e)
|
||||
})
|
||||
.finally(() => {
|
||||
this.isMigrating = false
|
||||
|
@ -96,10 +96,10 @@ export default {
|
||||
this.subscriptionService.create(subscription)
|
||||
.then(() => {
|
||||
this.$emit('change', subscription)
|
||||
this.success({message: `You are now subscribed to this ${this.entity}`}, this)
|
||||
this.success({message: `You are now subscribed to this ${this.entity}`})
|
||||
})
|
||||
.catch(e => {
|
||||
this.error(e, this)
|
||||
this.error(e)
|
||||
})
|
||||
},
|
||||
unsubscribe() {
|
||||
@ -110,10 +110,10 @@ export default {
|
||||
this.subscriptionService.delete(subscription)
|
||||
.then(() => {
|
||||
this.$emit('change', null)
|
||||
this.success({message: `You are now unsubscribed to this ${this.entity}`}, this)
|
||||
this.success({message: `You are now unsubscribed to this ${this.entity}`})
|
||||
})
|
||||
.catch(e => {
|
||||
this.error(e, this)
|
||||
this.error(e)
|
||||
})
|
||||
}
|
||||
},
|
||||
|
@ -43,7 +43,7 @@ export default {
|
||||
this.$set(this, 'namespaces', response)
|
||||
})
|
||||
.catch(e => {
|
||||
this.error(e, this)
|
||||
this.error(e)
|
||||
})
|
||||
},
|
||||
clearAll() {
|
||||
|
@ -98,7 +98,7 @@ export default {
|
||||
this.$set(this, 'allNotifications', r)
|
||||
})
|
||||
.catch(e => {
|
||||
this.error(e, this)
|
||||
this.error(e)
|
||||
})
|
||||
},
|
||||
to(n, index) {
|
||||
@ -136,7 +136,7 @@ export default {
|
||||
.then(r => {
|
||||
this.$set(this.allNotifications, index, r)
|
||||
})
|
||||
.catch(e => this.error(e, this))
|
||||
.catch(e => this.error(e))
|
||||
}
|
||||
},
|
||||
},
|
||||
|
@ -361,12 +361,12 @@ export default {
|
||||
})
|
||||
this.taskService.create(newTask)
|
||||
.then(r => {
|
||||
this.success({message: 'The task was successfully created.'}, this)
|
||||
this.success({message: 'The task was successfully created.'})
|
||||
this.$router.push({name: 'task.detail', params: {id: r.id}})
|
||||
this.closeQuickActions()
|
||||
})
|
||||
.catch((e) => {
|
||||
this.error(e, this)
|
||||
this.error(e)
|
||||
})
|
||||
},
|
||||
newList() {
|
||||
@ -380,12 +380,12 @@ export default {
|
||||
})
|
||||
this.listService.create(newList)
|
||||
.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}})
|
||||
this.closeQuickActions()
|
||||
})
|
||||
.catch((e) => {
|
||||
this.error(e, this)
|
||||
this.error(e)
|
||||
})
|
||||
},
|
||||
newNamespace() {
|
||||
@ -393,11 +393,11 @@ export default {
|
||||
this.namespaceService.create(newNamespace)
|
||||
.then(r => {
|
||||
this.$store.commit('namespaces/addNamespace', r)
|
||||
this.success({message: 'The namespace was successfully created.'}, this)
|
||||
this.success({message: 'The namespace was successfully created.'})
|
||||
this.closeQuickActions()
|
||||
})
|
||||
.catch((e) => {
|
||||
this.error(e, this)
|
||||
this.error(e)
|
||||
})
|
||||
},
|
||||
newTeam() {
|
||||
@ -408,11 +408,11 @@ export default {
|
||||
name: 'teams.edit',
|
||||
params: {id: r.id},
|
||||
})
|
||||
this.success({message: 'The team was successfully created.'}, this)
|
||||
this.success({message: 'The team was successfully created.'})
|
||||
this.closeQuickActions()
|
||||
})
|
||||
.catch((e) => {
|
||||
this.error(e, this)
|
||||
this.error(e)
|
||||
})
|
||||
},
|
||||
select(parentIndex, index) {
|
||||
|
@ -231,7 +231,7 @@ export default {
|
||||
this.linkShares = r
|
||||
})
|
||||
.catch((e) => {
|
||||
this.error(e, this)
|
||||
this.error(e)
|
||||
})
|
||||
},
|
||||
add() {
|
||||
@ -248,14 +248,11 @@ export default {
|
||||
this.name = ''
|
||||
this.password = ''
|
||||
this.showNewForm = false
|
||||
this.success(
|
||||
{message: 'The link share was successfully created'},
|
||||
this
|
||||
)
|
||||
this.success({message: 'The link share was successfully created'})
|
||||
this.load()
|
||||
})
|
||||
.catch((e) => {
|
||||
this.error(e, this)
|
||||
this.error(e)
|
||||
})
|
||||
},
|
||||
remove() {
|
||||
@ -266,14 +263,11 @@ export default {
|
||||
this.linkShareService
|
||||
.delete(linkshare)
|
||||
.then(() => {
|
||||
this.success(
|
||||
{message: 'The link share was successfully deleted'},
|
||||
this
|
||||
)
|
||||
this.success({message: 'The link share was successfully deleted'})
|
||||
this.load()
|
||||
})
|
||||
.catch((e) => {
|
||||
this.error(e, this)
|
||||
this.error(e)
|
||||
})
|
||||
.finally(() => {
|
||||
this.showDeleteModal = false
|
||||
|
@ -249,7 +249,7 @@ export default {
|
||||
)
|
||||
})
|
||||
.catch((e) => {
|
||||
this.error(e, this)
|
||||
this.error(e)
|
||||
})
|
||||
},
|
||||
deleteSharable() {
|
||||
@ -271,10 +271,10 @@ export default {
|
||||
this.sharables.splice(i, 1)
|
||||
}
|
||||
}
|
||||
this.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}.`})
|
||||
})
|
||||
.catch((e) => {
|
||||
this.error(e, this)
|
||||
this.error(e)
|
||||
})
|
||||
},
|
||||
add(admin) {
|
||||
@ -295,19 +295,16 @@ export default {
|
||||
this.stuffService
|
||||
.create(this.stuffModel)
|
||||
.then(() => {
|
||||
this.success(
|
||||
{
|
||||
message:
|
||||
'The ' +
|
||||
this.shareType +
|
||||
' was successfully added.',
|
||||
},
|
||||
this
|
||||
)
|
||||
this.success({
|
||||
message:
|
||||
'The ' +
|
||||
this.shareType +
|
||||
' was successfully added.',
|
||||
})
|
||||
this.load()
|
||||
})
|
||||
.catch((e) => {
|
||||
this.error(e, this)
|
||||
this.error(e)
|
||||
})
|
||||
},
|
||||
toggleType(sharable) {
|
||||
@ -340,18 +337,15 @@ export default {
|
||||
this.$set(this.sharables[i], 'right', r.right)
|
||||
}
|
||||
}
|
||||
this.success(
|
||||
{
|
||||
message:
|
||||
'The ' +
|
||||
this.shareType +
|
||||
' right was successfully updated.',
|
||||
},
|
||||
this
|
||||
)
|
||||
this.success({
|
||||
message:
|
||||
'The ' +
|
||||
this.shareType +
|
||||
' right was successfully updated.',
|
||||
})
|
||||
})
|
||||
.catch((e) => {
|
||||
this.error(e, this)
|
||||
this.error(e)
|
||||
})
|
||||
},
|
||||
find(query) {
|
||||
@ -366,7 +360,7 @@ export default {
|
||||
this.$set(this, 'found', response)
|
||||
})
|
||||
.catch((e) => {
|
||||
this.error(e, this)
|
||||
this.error(e)
|
||||
})
|
||||
},
|
||||
clearAll() {
|
||||
|
@ -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)
|
||||
})
|
||||
},
|
||||
},
|
||||
|
@ -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)
|
||||
})
|
||||
},
|
||||
},
|
||||
|
@ -31,7 +31,7 @@ export default {
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
this.error(e, this)
|
||||
this.error(e)
|
||||
})
|
||||
},
|
||||
},
|
||||
|
@ -115,7 +115,7 @@ export default {
|
||||
this.loadedList = cloneDeep(currentList)
|
||||
})
|
||||
.catch(e => {
|
||||
this.error(e, this)
|
||||
this.error(e)
|
||||
})
|
||||
},
|
||||
loadTasksForPage(e) {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -131,7 +131,7 @@ export default {
|
||||
this.$emit('input', r)
|
||||
})
|
||||
.catch((e) => {
|
||||
this.error(e, this)
|
||||
this.error(e)
|
||||
})
|
||||
},
|
||||
},
|
||||
|
@ -86,7 +86,7 @@ export default {
|
||||
}, 2000)
|
||||
})
|
||||
.catch(e => {
|
||||
this.error(e, this)
|
||||
this.error(e)
|
||||
})
|
||||
.finally(() => {
|
||||
this.saving = false
|
||||
|
@ -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() {
|
||||
|
@ -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)
|
||||
})
|
||||
},
|
||||
|
||||
|
@ -90,7 +90,7 @@ export default {
|
||||
}, 2000)
|
||||
})
|
||||
.catch(e => {
|
||||
this.error(e, this)
|
||||
this.error(e)
|
||||
})
|
||||
.finally(() => {
|
||||
this.saving = false
|
||||
|
@ -51,7 +51,7 @@ export default {
|
||||
this.$set(this, 'foundLists', response)
|
||||
})
|
||||
.catch(e => {
|
||||
this.error(e, this)
|
||||
this.error(e)
|
||||
})
|
||||
},
|
||||
clearAll() {
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -93,16 +93,16 @@ export default {
|
||||
.then(r => {
|
||||
this.avatarProvider = r.avatarProvider
|
||||
})
|
||||
.catch(e => this.error(e, this))
|
||||
.catch(e => this.error(e))
|
||||
},
|
||||
updateAvatarStatus() {
|
||||
const avatarStatus = new AvatarModel({avatarProvider: this.avatarProvider})
|
||||
this.avatarService.update(avatarStatus)
|
||||
.then(() => {
|
||||
this.success({message: 'Avatar status was updated successfully!'}, this)
|
||||
this.success({message: 'Avatar status was updated successfully!'})
|
||||
this.$store.commit('auth/reloadAvatar')
|
||||
})
|
||||
.catch(e => this.error(e, this))
|
||||
.catch(e => this.error(e))
|
||||
},
|
||||
uploadAvatar() {
|
||||
this.loading = true
|
||||
@ -112,10 +112,10 @@ export default {
|
||||
canvas.toBlob(blob => {
|
||||
this.avatarService.create(blob)
|
||||
.then(() => {
|
||||
this.success({message: 'The avatar has been set successfully!'}, this)
|
||||
this.success({message: 'The avatar has been set successfully!'})
|
||||
this.$store.commit('auth/reloadAvatar')
|
||||
})
|
||||
.catch(e => this.error(e, this))
|
||||
.catch(e => this.error(e))
|
||||
.finally(() => {
|
||||
this.loading = false
|
||||
this.isCropAvatar = false
|
||||
|
Reference in New Issue
Block a user