From cdc805c8dae15434211b0bf3c57f20aef86d276c Mon Sep 17 00:00:00 2001 From: kolaente Date: Tue, 22 Jun 2021 22:07:57 +0200 Subject: [PATCH] Refactor success and error messages --- src/components/home/contentAuth.vue | 2 +- src/components/home/navigation.vue | 2 +- src/components/list/partials/filters.vue | 4 +- src/components/migrator/migration.vue | 6 +- src/components/misc/subscription.vue | 8 +-- src/components/namespace/namespace-search.vue | 2 +- .../notifications/notifications.vue | 4 +- .../quick-actions/quick-actions.vue | 16 +++--- src/components/sharing/linkSharing.vue | 16 ++---- src/components/sharing/userTeam.vue | 42 ++++++-------- src/components/tasks/edit-task.vue | 4 +- src/components/tasks/gantt-component.vue | 6 +- .../tasks/mixins/attachmentUpload.js | 2 +- src/components/tasks/mixins/taskList.js | 2 +- src/components/tasks/partials/attachments.vue | 4 +- src/components/tasks/partials/comments.vue | 13 ++--- src/components/tasks/partials/defer-task.vue | 2 +- src/components/tasks/partials/description.vue | 2 +- .../tasks/partials/editAssignees.vue | 10 ++-- src/components/tasks/partials/editLabels.vue | 12 ++-- src/components/tasks/partials/heading.vue | 2 +- src/components/tasks/partials/listSearch.vue | 2 +- .../tasks/partials/relatedTasks.vue | 8 +-- .../tasks/partials/singleTaskInList.vue | 22 +++----- src/components/user/avatar-settings.vue | 10 ++-- src/main.js | 8 ++- src/message/index.js | 9 --- src/views/filters/CreateSavedFilter.vue | 2 +- src/views/filters/settings/delete.vue | 4 +- src/views/filters/settings/edit.vue | 6 +- src/views/labels/ListLabels.vue | 10 ++-- src/views/labels/NewLabel.vue | 4 +- src/views/list/NewList.vue | 7 +-- src/views/list/ShowList.vue | 2 +- src/views/list/settings/archive.vue | 4 +- src/views/list/settings/background.vue | 14 ++--- src/views/list/settings/delete.vue | 4 +- src/views/list/settings/duplicate.vue | 4 +- src/views/list/settings/edit.vue | 6 +- src/views/list/settings/share.vue | 2 +- src/views/list/views/Kanban.vue | 28 +++++----- src/views/list/views/List.vue | 10 ++-- src/views/namespaces/ListNamespaces.vue | 4 +- src/views/namespaces/NewNamespace.vue | 7 +-- src/views/namespaces/settings/archive.vue | 4 +- src/views/namespaces/settings/delete.vue | 4 +- src/views/namespaces/settings/edit.vue | 6 +- src/views/namespaces/settings/share.vue | 2 +- src/views/tasks/ShowTasks.vue | 2 +- src/views/tasks/TaskDetailView.vue | 10 ++-- src/views/teams/EditTeam.vue | 55 +++++++------------ src/views/teams/ListTeams.vue | 2 +- src/views/teams/NewTeam.vue | 7 +-- src/views/user/Login.vue | 19 +++++-- src/views/user/Settings.vue | 26 ++++----- 55 files changed, 219 insertions(+), 256 deletions(-) diff --git a/src/components/home/contentAuth.vue b/src/components/home/contentAuth.vue index 576d77bf0..55ab90f8d 100644 --- a/src/components/home/contentAuth.vue +++ b/src/components/home/contentAuth.vue @@ -130,7 +130,7 @@ export default { loadLabels() { this.$store.dispatch('labels/loadAllLabels') .catch(e => { - this.error(e, this) + this.error(e) }) }, }, diff --git a/src/components/home/navigation.vue b/src/components/home/navigation.vue index a2933d759..05b8cd2a5 100644 --- a/src/components/home/navigation.vue +++ b/src/components/home/navigation.vue @@ -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 diff --git a/src/components/list/partials/filters.vue b/src/components/list/partials/filters.vue index a28f339e6..448222d0f 100644 --- a/src/components/list/partials/filters.vue +++ b/src/components/list/partials/filters.vue @@ -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) { diff --git a/src/components/migrator/migration.vue b/src/components/migrator/migration.vue index 4b65fc9fc..c6de5f2b5 100644 --- a/src/components/migrator/migration.vue +++ b/src/components/migrator/migration.vue @@ -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 diff --git a/src/components/misc/subscription.vue b/src/components/misc/subscription.vue index d59a491c6..82ad2f620 100644 --- a/src/components/misc/subscription.vue +++ b/src/components/misc/subscription.vue @@ -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) }) } }, diff --git a/src/components/namespace/namespace-search.vue b/src/components/namespace/namespace-search.vue index d2fbc556a..8444d6168 100644 --- a/src/components/namespace/namespace-search.vue +++ b/src/components/namespace/namespace-search.vue @@ -43,7 +43,7 @@ export default { this.$set(this, 'namespaces', response) }) .catch(e => { - this.error(e, this) + this.error(e) }) }, clearAll() { diff --git a/src/components/notifications/notifications.vue b/src/components/notifications/notifications.vue index e0f72422d..00a76250f 100644 --- a/src/components/notifications/notifications.vue +++ b/src/components/notifications/notifications.vue @@ -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)) } }, }, diff --git a/src/components/quick-actions/quick-actions.vue b/src/components/quick-actions/quick-actions.vue index 02279db4f..c55b887f7 100644 --- a/src/components/quick-actions/quick-actions.vue +++ b/src/components/quick-actions/quick-actions.vue @@ -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) { diff --git a/src/components/sharing/linkSharing.vue b/src/components/sharing/linkSharing.vue index 8094649a1..802015770 100644 --- a/src/components/sharing/linkSharing.vue +++ b/src/components/sharing/linkSharing.vue @@ -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 diff --git a/src/components/sharing/userTeam.vue b/src/components/sharing/userTeam.vue index cad550ce4..3a72d7e3b 100644 --- a/src/components/sharing/userTeam.vue +++ b/src/components/sharing/userTeam.vue @@ -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() { diff --git a/src/components/tasks/edit-task.vue b/src/components/tasks/edit-task.vue index 0e4f63939..208818bfc 100644 --- a/src/components/tasks/edit-task.vue +++ b/src/components/tasks/edit-task.vue @@ -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) }) }, }, diff --git a/src/components/tasks/gantt-component.vue b/src/components/tasks/gantt-component.vue index d27bd37fa..8147ca3d6 100644 --- a/src/components/tasks/gantt-component.vue +++ b/src/components/tasks/gantt-component.vue @@ -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) }) }, }, diff --git a/src/components/tasks/mixins/attachmentUpload.js b/src/components/tasks/mixins/attachmentUpload.js index 7d0330811..1e08e0fc4 100644 --- a/src/components/tasks/mixins/attachmentUpload.js +++ b/src/components/tasks/mixins/attachmentUpload.js @@ -31,7 +31,7 @@ export default { } }) .catch(e => { - this.error(e, this) + this.error(e) }) }, }, diff --git a/src/components/tasks/mixins/taskList.js b/src/components/tasks/mixins/taskList.js index 6748ad068..a6e91c2db 100644 --- a/src/components/tasks/mixins/taskList.js +++ b/src/components/tasks/mixins/taskList.js @@ -115,7 +115,7 @@ export default { this.loadedList = cloneDeep(currentList) }) .catch(e => { - this.error(e, this) + this.error(e) }) }, loadTasksForPage(e) { diff --git a/src/components/tasks/partials/attachments.vue b/src/components/tasks/partials/attachments.vue index 3e20b36b6..59c2be26a 100644 --- a/src/components/tasks/partials/attachments.vue +++ b/src/components/tasks/partials/attachments.vue @@ -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 diff --git a/src/components/tasks/partials/comments.vue b/src/components/tasks/partials/comments.vue index 848731b56..838bbe1b1 100644 --- a/src/components/tasks/partials/comments.vue +++ b/src/components/tasks/partials/comments.vue @@ -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 diff --git a/src/components/tasks/partials/defer-task.vue b/src/components/tasks/partials/defer-task.vue index 0f6c0c474..93a1f1830 100644 --- a/src/components/tasks/partials/defer-task.vue +++ b/src/components/tasks/partials/defer-task.vue @@ -131,7 +131,7 @@ export default { this.$emit('input', r) }) .catch((e) => { - this.error(e, this) + this.error(e) }) }, }, diff --git a/src/components/tasks/partials/description.vue b/src/components/tasks/partials/description.vue index 738973f72..fed482529 100644 --- a/src/components/tasks/partials/description.vue +++ b/src/components/tasks/partials/description.vue @@ -86,7 +86,7 @@ export default { }, 2000) }) .catch(e => { - this.error(e, this) + this.error(e) }) .finally(() => { this.saving = false diff --git a/src/components/tasks/partials/editAssignees.vue b/src/components/tasks/partials/editAssignees.vue index bb3f04cd8..ec98ac134 100644 --- a/src/components/tasks/partials/editAssignees.vue +++ b/src/components/tasks/partials/editAssignees.vue @@ -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() { diff --git a/src/components/tasks/partials/editLabels.vue b/src/components/tasks/partials/editLabels.vue index 5c03449cf..92f3ba28e 100644 --- a/src/components/tasks/partials/editLabels.vue +++ b/src/components/tasks/partials/editLabels.vue @@ -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) }) }, diff --git a/src/components/tasks/partials/heading.vue b/src/components/tasks/partials/heading.vue index 35dc55c9d..e4b70ab48 100644 --- a/src/components/tasks/partials/heading.vue +++ b/src/components/tasks/partials/heading.vue @@ -90,7 +90,7 @@ export default { }, 2000) }) .catch(e => { - this.error(e, this) + this.error(e) }) .finally(() => { this.saving = false diff --git a/src/components/tasks/partials/listSearch.vue b/src/components/tasks/partials/listSearch.vue index 9d1582f25..3c281ea1c 100644 --- a/src/components/tasks/partials/listSearch.vue +++ b/src/components/tasks/partials/listSearch.vue @@ -51,7 +51,7 @@ export default { this.$set(this, 'foundLists', response) }) .catch(e => { - this.error(e, this) + this.error(e) }) }, clearAll() { diff --git a/src/components/tasks/partials/relatedTasks.vue b/src/components/tasks/partials/relatedTasks.vue index d2a0c5443..40de796c7 100644 --- a/src/components/tasks/partials/relatedTasks.vue +++ b/src/components/tasks/partials/relatedTasks.vue @@ -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) { diff --git a/src/components/tasks/partials/singleTaskInList.vue b/src/components/tasks/partials/singleTaskInList.vue index 7031e7c14..a1537077c 100644 --- a/src/components/tasks/partials/singleTaskInList.vue +++ b/src/components/tasks/partials/singleTaskInList.vue @@ -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) { diff --git a/src/components/user/avatar-settings.vue b/src/components/user/avatar-settings.vue index 319da3200..47de56b8a 100644 --- a/src/components/user/avatar-settings.vue +++ b/src/components/user/avatar-settings.vue @@ -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 diff --git a/src/main.js b/src/main.js index 07c0880cd..012d59298 100644 --- a/src/main.js +++ b/src/main.js @@ -215,8 +215,12 @@ Vue.mixin({ }, formatDate: date => formatDate(date, 'PPPPpppp'), formatDateShort: date => formatDate(date, 'PPpp'), - error: (e, context, actions = []) => message.error(e, context, actions), - success: (s, context, actions = []) => message.success(s, context, actions), + error(e, actions = []) { + return message.error(e, this, actions) + }, + success(s, actions = []) { + return message.success(s, this, actions) + }, colorIsDark: colorIsDark, setTitle: setTitle, }, diff --git a/src/message/index.js b/src/message/index.js index 6f4569ad4..7d3f06b21 100644 --- a/src/message/index.js +++ b/src/message/index.js @@ -1,13 +1,4 @@ export default { - setLoading(context) { - const timeout = setTimeout(function () { - context.loading = true - }, 100) - return () => { - clearTimeout(timeout) - context.loading = false - } - }, error(e, context, actions = []) { // Build the notification text from error response let err = e.message diff --git a/src/views/filters/CreateSavedFilter.vue b/src/views/filters/CreateSavedFilter.vue index abd521462..b028ac33f 100644 --- a/src/views/filters/CreateSavedFilter.vue +++ b/src/views/filters/CreateSavedFilter.vue @@ -110,7 +110,7 @@ export default { this.$store.dispatch('namespaces/loadNamespaces') this.$router.push({name: 'list.index', params: {listId: r.getListId()}}) }) - .catch(e => this.error(e, this)) + .catch(e => this.error(e)) }, }, } diff --git a/src/views/filters/settings/delete.vue b/src/views/filters/settings/delete.vue index 9102c3d68..6a8ccc964 100644 --- a/src/views/filters/settings/delete.vue +++ b/src/views/filters/settings/delete.vue @@ -34,10 +34,10 @@ export default { this.filterService.delete(filter) .then(() => { this.$store.dispatch('namespaces/loadNamespaces') - this.success({message: 'The filter was deleted successfully.'}, this) + this.success({message: 'The filter was deleted successfully.'}) this.$router.push({name: 'namespaces.index'}) }) - .catch(e => this.error(e, this)) + .catch(e => this.error(e)) }, }, } diff --git a/src/views/filters/settings/edit.vue b/src/views/filters/settings/edit.vue index 9e7dbdc55..0a7d8945f 100644 --- a/src/views/filters/settings/edit.vue +++ b/src/views/filters/settings/edit.vue @@ -110,19 +110,19 @@ export default { this.filter = r this.filters = objectToSnakeCase(this.filter.filters) }) - .catch(e => this.error(e, this)) + .catch(e => this.error(e)) }, save() { this.filter.filters = this.filters this.filterService.update(this.filter) .then(r => { this.$store.dispatch('namespaces/loadNamespaces') - this.success({message: 'The filter was saved successfully.'}, this) + this.success({message: 'The filter was saved successfully.'}) this.filter = r this.filters = objectToSnakeCase(this.filter.filters) this.$router.back() }) - .catch(e => this.error(e, this)) + .catch(e => this.error(e)) }, }, } diff --git a/src/views/labels/ListLabels.vue b/src/views/labels/ListLabels.vue index ddeeca4a8..5bbe9f05b 100644 --- a/src/views/labels/ListLabels.vue +++ b/src/views/labels/ListLabels.vue @@ -141,25 +141,25 @@ export default { loadLabels() { this.$store.dispatch('labels/loadAllLabels') .catch(e => { - this.error(e, this) + this.error(e) }) }, deleteLabel(label) { this.$store.dispatch('labels/deleteLabel', label) .then(() => { - this.success({message: 'The label was successfully deleted.'}, this) + this.success({message: 'The label was successfully deleted.'}) }) .catch(e => { - this.error(e, this) + this.error(e) }) }, editLabelSubmit() { this.$store.dispatch('labels/updateLabel', this.labelEditLabel) .then(() => { - this.success({message: 'The label was successfully updated.'}, this) + this.success({message: 'The label was successfully updated.'}) }) .catch(e => { - this.error(e, this) + this.error(e) }) }, editLabel(label) { diff --git a/src/views/labels/NewLabel.vue b/src/views/labels/NewLabel.vue index a0925d1bb..885948311 100644 --- a/src/views/labels/NewLabel.vue +++ b/src/views/labels/NewLabel.vue @@ -77,10 +77,10 @@ export default { name: 'labels.index', params: {id: r.id}, }) - this.success({message: 'The label was successfully created.'}, this) + this.success({message: 'The label was successfully created.'}) }) .catch((e) => { - this.error(e, this) + this.error(e) }) }, }, diff --git a/src/views/list/NewList.vue b/src/views/list/NewList.vue index 2aa6bd03e..89d917ce8 100644 --- a/src/views/list/NewList.vue +++ b/src/views/list/NewList.vue @@ -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) }) }, }, diff --git a/src/views/list/ShowList.vue b/src/views/list/ShowList.vue index ccadc6de3..1643de354 100644 --- a/src/views/list/ShowList.vue +++ b/src/views/list/ShowList.vue @@ -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 diff --git a/src/views/list/settings/archive.vue b/src/views/list/settings/archive.vue index 87a63cd78..a8a19e86d 100644 --- a/src/views/list/settings/archive.vue +++ b/src/views/list/settings/archive.vue @@ -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() diff --git a/src/views/list/settings/background.vue b/src/views/list/settings/background.vue index 689905de6..51dc73ae6 100644 --- a/src/views/list/settings/background.vue +++ b/src/views/list/settings/background.vue @@ -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) }) }, }, diff --git a/src/views/list/settings/delete.vue b/src/views/list/settings/delete.vue index 942853461..b5857958a 100644 --- a/src/views/list/settings/delete.vue +++ b/src/views/list/settings/delete.vue @@ -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) }) }, }, diff --git a/src/views/list/settings/duplicate.vue b/src/views/list/settings/duplicate.vue index d15cb6bcc..d03701dee 100644 --- a/src/views/list/settings/duplicate.vue +++ b/src/views/list/settings/duplicate.vue @@ -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) }) }, }, diff --git a/src/views/list/settings/edit.vue b/src/views/list/settings/edit.vue index ffc29c856..226cc99a5 100644 --- a/src/views/list/settings/edit.vue +++ b/src/views/list/settings/edit.vue @@ -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) }) }, }, diff --git a/src/views/list/settings/share.vue b/src/views/list/settings/share.vue index e0c763629..1955745e2 100644 --- a/src/views/list/settings/share.vue +++ b/src/views/list/settings/share.vue @@ -70,7 +70,7 @@ export default { this.setTitle(`Share "${this.list.title}"`) }) .catch(e => { - this.error(e, this) + this.error(e) }) }, }, diff --git a/src/views/list/views/Kanban.vue b/src/views/list/views/Kanban.vue index 59515dec6..7da19a732 100644 --- a/src/views/list/views/Kanban.vue +++ b/src/views/list/views/Kanban.vue @@ -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 }) }, diff --git a/src/views/list/views/List.vue b/src/views/list/views/List.vue index 46b5bd7e4..7ee215529 100644 --- a/src/views/list/views/List.vue +++ b/src/views/list/views/List.vue @@ -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) { diff --git a/src/views/namespaces/ListNamespaces.vue b/src/views/namespaces/ListNamespaces.vue index 7edf311c6..dbd74c2bb 100644 --- a/src/views/namespaces/ListNamespaces.vue +++ b/src/views/namespaces/ListNamespaces.vue @@ -131,7 +131,7 @@ export default { this.$set(this.backgrounds, l.id, b) }) .catch(e => { - this.error(e, this) + this.error(e) }) } }) @@ -144,7 +144,7 @@ export default { return } this.$store.dispatch('lists/toggleListFavorite', list) - .catch(e => this.error(e, this)) + .catch(e => this.error(e)) }, saveShowArchivedState() { localStorage.setItem('showArchived', JSON.stringify(this.showArchived)) diff --git a/src/views/namespaces/NewNamespace.vue b/src/views/namespaces/NewNamespace.vue index 4d041d741..05df04d3f 100644 --- a/src/views/namespaces/NewNamespace.vue +++ b/src/views/namespaces/NewNamespace.vue @@ -80,14 +80,11 @@ export default { .create(this.namespace) .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.$router.back() }) .catch((e) => { - this.error(e, this) + this.error(e) }) }, }, diff --git a/src/views/namespaces/settings/archive.vue b/src/views/namespaces/settings/archive.vue index 3e4e5f5e2..c57aed036 100644 --- a/src/views/namespaces/settings/archive.vue +++ b/src/views/namespaces/settings/archive.vue @@ -38,10 +38,10 @@ export default { this.namespaceService.update(this.namespace) .then(r => { this.$store.commit('namespaces/setNamespaceById', r) - this.success({message: 'The namespace was successfully archived.'}, this) + this.success({message: 'The namespace was successfully archived.'}) }) .catch(e => { - this.error(e, this) + this.error(e) }) .finally(() => { this.$router.back() diff --git a/src/views/namespaces/settings/delete.vue b/src/views/namespaces/settings/delete.vue index dd58a7496..6f9b5b586 100644 --- a/src/views/namespaces/settings/delete.vue +++ b/src/views/namespaces/settings/delete.vue @@ -31,11 +31,11 @@ export default { this.$store.dispatch('namespaces/deleteNamespace', namespace) .then(() => { - this.success({message: 'The namespace was successfully deleted.'}, this) + this.success({message: 'The namespace was successfully deleted.'}) this.$router.push({name: 'home'}) }) .catch(e => { - this.error(e, this) + this.error(e) }) }, }, diff --git a/src/views/namespaces/settings/edit.vue b/src/views/namespaces/settings/edit.vue index 489bd60d9..c5e8dc84a 100644 --- a/src/views/namespaces/settings/edit.vue +++ b/src/views/namespaces/settings/edit.vue @@ -118,7 +118,7 @@ export default { this.setTitle(`Edit "${r.title}"`) }) .catch(e => { - this.error(e, this) + this.error(e) }) }, save() { @@ -126,11 +126,11 @@ export default { .then(r => { // Update the namespace in the parent this.$store.commit('namespaces/setNamespaceById', r) - this.success({message: 'The namespace was successfully updated.'}, this) + this.success({message: 'The namespace was successfully updated.'}) this.$router.back() }) .catch(e => { - this.error(e, this) + this.error(e) }) }, }, diff --git a/src/views/namespaces/settings/share.vue b/src/views/namespaces/settings/share.vue index 7836aa31e..d7bfd5ba8 100644 --- a/src/views/namespaces/settings/share.vue +++ b/src/views/namespaces/settings/share.vue @@ -69,7 +69,7 @@ export default { this.setTitle(`Share "${this.namespace.title}"`) }) .catch(e => { - this.error(e, this) + this.error(e) }) }, }, diff --git a/src/views/tasks/ShowTasks.vue b/src/views/tasks/ShowTasks.vue index bf0b976f0..dd005fa06 100644 --- a/src/views/tasks/ShowTasks.vue +++ b/src/views/tasks/ShowTasks.vue @@ -203,7 +203,7 @@ export default { this.$store.commit(HAS_TASKS, r.length > 0) }) .catch(e => { - this.error(e, this) + this.error(e) }) }, updateTasks(updatedTask) { diff --git a/src/views/tasks/TaskDetailView.vue b/src/views/tasks/TaskDetailView.vue index 65c7cd2ce..8f4c9e759 100644 --- a/src/views/tasks/TaskDetailView.vue +++ b/src/views/tasks/TaskDetailView.vue @@ -559,7 +559,7 @@ export default { this.setTitle(this.task.title) }) .catch(e => { - this.error(e, this) + this.error(e) }) .finally(() => { this.$nextTick(() => this.visible = true) @@ -620,10 +620,10 @@ export default { callback: undoCallback, }] } - this.success({message: 'The task was saved successfully.'}, this, actions) + this.success({message: 'The task was saved successfully.'}, actions) }) .catch(e => { - this.error(e, this) + this.error(e) }) }) }, @@ -648,11 +648,11 @@ export default { deleteTask() { this.$store.dispatch('tasks/delete', this.task) .then(() => { - this.success({message: 'The task has been deleted successfully.'}, this) + this.success({message: 'The task has been deleted successfully.'}) this.$router.push({name: 'list.index', params: {listId: this.task.listId}}) }) .catch(e => { - this.error(e, this) + this.error(e) }) }, toggleTaskDone() { diff --git a/src/views/teams/EditTeam.vue b/src/views/teams/EditTeam.vue index 72fdad59b..8c6c313e3 100644 --- a/src/views/teams/EditTeam.vue +++ b/src/views/teams/EditTeam.vue @@ -249,7 +249,7 @@ export default { this.setTitle(`Edit Team ${this.team.name}`) }) .catch((e) => { - this.error(e, this) + this.error(e) }) }, save() { @@ -263,44 +263,35 @@ export default { .update(this.team) .then((response) => { this.team = response - this.success( - {message: 'The team was successfully updated.'}, - this - ) + this.success({message: 'The team was successfully updated.'}) }) .catch((e) => { - this.error(e, this) + this.error(e) }) }, deleteTeam() { this.teamService .delete(this.team) .then(() => { - this.success( - {message: 'The team was successfully deleted.'}, - this - ) + this.success({message: 'The team was successfully deleted.'}) router.push({name: 'teams.index'}) }) .catch((e) => { - this.error(e, this) + this.error(e) }) }, deleteUser() { this.teamMemberService .delete(this.member) .then(() => { - this.success( - { - message: - 'The user was successfully deleted from the team.', - }, - this - ) + this.success({ + message: + 'The user was successfully deleted from the team.', + }) this.loadTeam() }) .catch((e) => { - this.error(e, this) + this.error(e) }) .finally(() => { this.showUserDeleteModal = false @@ -315,13 +306,10 @@ export default { .create(newMember) .then(() => { this.loadTeam() - this.success( - {message: 'The team member was successfully added.'}, - this - ) + this.success({message: 'The team member was successfully added.'}) }) .catch((e) => { - this.error(e, this) + this.error(e) }) }, toggleUserType(member) { @@ -336,18 +324,15 @@ export default { break } } - this.success( - { - message: - 'The team member was successfully made ' + - (member.admin ? 'admin' : 'member') + - '.', - }, - this - ) + this.success({ + message: + 'The team member was successfully made ' + + (member.admin ? 'admin' : 'member') + + '.', + }) }) .catch((e) => { - this.error(e, this) + this.error(e) }) }, findUser(query) { @@ -362,7 +347,7 @@ export default { this.$set(this, 'foundUsers', response) }) .catch((e) => { - this.error(e, this) + this.error(e) }) }, clearAll() { diff --git a/src/views/teams/ListTeams.vue b/src/views/teams/ListTeams.vue index 832987ece..e3f962ef8 100644 --- a/src/views/teams/ListTeams.vue +++ b/src/views/teams/ListTeams.vue @@ -50,7 +50,7 @@ export default { this.$set(this, 'teams', response) }) .catch(e => { - this.error(e, this) + this.error(e) }) }, }, diff --git a/src/views/teams/NewTeam.vue b/src/views/teams/NewTeam.vue index 22708923a..594c97982 100644 --- a/src/views/teams/NewTeam.vue +++ b/src/views/teams/NewTeam.vue @@ -67,13 +67,10 @@ export default { name: 'teams.edit', params: { id: response.id }, }) - this.success( - { message: 'The team was successfully created.' }, - this - ) + this.success({message: 'The team was successfully created.'}) }) .catch((e) => { - this.error(e, this) + this.error(e) }) }, }, diff --git a/src/views/user/Login.vue b/src/views/user/Login.vue index d097185f9..3fcd8215c 100644 --- a/src/views/user/Login.vue +++ b/src/views/user/Login.vue @@ -82,7 +82,9 @@ -
+
{ localStorage.removeItem('emailConfirmToken') @@ -158,6 +159,15 @@ export default { openidConnect: state => state.config.auth.openidConnect, }), methods: { + setLoading() { + const timeout = setTimeout(() => { + this.loading = true + }, 100) + return () => { + clearTimeout(timeout) + this.loading = false + } + }, submit() { this.$store.commit(ERROR_MESSAGE, '') // Some browsers prevent Vue bindings from working with autofilled values. @@ -173,7 +183,8 @@ export default { } this.$store.dispatch('auth/login', credentials) - .catch(() => {}) + .catch(() => { + }) }, redirectToProvider(provider) { const state = Math.random().toString(36).substring(2, 24) diff --git a/src/views/user/Settings.vue b/src/views/user/Settings.vue index 956515705..adbf38329 100644 --- a/src/views/user/Settings.vue +++ b/src/views/user/Settings.vue @@ -338,22 +338,22 @@ export default { methods: { updatePassword() { if (this.passwordConfirm !== this.passwordUpdate.newPassword) { - this.error({message: 'The new password and its confirmation don\'t match.'}, this) + this.error({message: 'The new password and its confirmation don\'t match.'}) return } this.passwordUpdateService.update(this.passwordUpdate) .then(() => { - this.success({message: 'The password was successfully updated.'}, this) + this.success({message: 'The password was successfully updated.'}) }) - .catch(e => this.error(e, this)) + .catch(e => this.error(e)) }, updateEmail() { this.emailUpdateService.update(this.emailUpdate) .then(() => { - this.success({message: 'Your email address was successfully updated. We\'ve sent you a link to confirm it.'}, this) + this.success({message: 'Your email address was successfully updated. We\'ve sent you a link to confirm it.'}) }) - .catch(e => this.error(e, this)) + .catch(e => this.error(e)) }, totpStatus() { if (!this.totpEnabled) { @@ -371,7 +371,7 @@ export default { return } - this.error(e, this) + this.error(e) }) }, totpSetQrCode() { @@ -388,24 +388,24 @@ export default { this.$set(this, 'totp', r) this.totpSetQrCode() }) - .catch(e => this.error(e, this)) + .catch(e => this.error(e)) }, totpConfirm() { this.totpService.enable({passcode: this.totpConfirmPasscode}) .then(() => { this.$set(this.totp, 'enabled', true) - this.success({message: 'You\'ve successfully confirmed your totp setup and can use it from now on!'}, this) + this.success({message: 'You\'ve successfully confirmed your totp setup and can use it from now on!'}) }) - .catch(e => this.error(e, this)) + .catch(e => this.error(e)) }, totpDisable() { this.totpService.disable({password: this.totpDisablePassword}) .then(() => { this.totpEnrolled = false this.$set(this, 'totp', new TotpModel()) - this.success({message: 'Two factor authentication was sucessfully disabled.'}, this) + this.success({message: 'Two factor authentication was sucessfully disabled.'}) }) - .catch(e => this.error(e, this)) + .catch(e => this.error(e)) }, updateSettings() { localStorage.setItem(playSoundWhenDoneKey, this.playSoundWhenDone) @@ -413,9 +413,9 @@ export default { this.userSettingsService.update(this.settings) .then(() => { this.$store.commit('auth/setUserSettings', this.settings) - this.success({message: 'The name was successfully changed.'}, this) + this.success({message: 'The name was successfully changed.'}) }) - .catch(e => this.error(e, this)) + .catch(e => this.error(e)) }, copy(text) { copy(text)