Commit 092d4ca6 authored by Fatih Acet's avatar Fatih Acet

IssueNotesRefactor: Move catch statements into main file to make ESLint happy.

It was happy before I don’t know what broke its heart.
parent ff6acdf1
<script> <script>
/* global Flash */
import IssueNote from './issue_note.vue'; import IssueNote from './issue_note.vue';
import UserAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue'; import UserAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue';
import IssueNoteHeader from './issue_note_header.vue'; import IssueNoteHeader from './issue_note_header.vue';
...@@ -76,6 +78,9 @@ export default { ...@@ -76,6 +78,9 @@ export default {
this.$store.dispatch('replyToDiscussion', data) this.$store.dispatch('replyToDiscussion', data)
.then(() => { .then(() => {
this.isReplying = false; this.isReplying = false;
})
.catch(() => {
new Flash('Something went wrong while adding your reply. Please try again.'); // eslint-disable-line
}); });
}, },
}, },
......
<script> <script>
/* global Flash */
import UserAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue'; import UserAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue';
import IssueNoteHeader from './issue_note_header.vue'; import IssueNoteHeader from './issue_note_header.vue';
import IssueNoteActions from './issue_note_actions.vue'; import IssueNoteActions from './issue_note_actions.vue';
...@@ -50,6 +52,7 @@ export default { ...@@ -50,6 +52,7 @@ export default {
this.isDeleting = false; this.isDeleting = false;
}) })
.catch(() => { .catch(() => {
new Flash('Something went wrong while deleting your note. Please try again.'); // eslint-disable-line
this.isDeleting = false; this.isDeleting = false;
}); });
} }
......
...@@ -20,7 +20,7 @@ export default { ...@@ -20,7 +20,7 @@ export default {
type: String, type: String,
required: false, required: false,
default: 'Save comment', default: 'Save comment',
} },
}, },
data() { data() {
return { return {
......
<script> <script>
/* global Flash */
import Vue from 'vue'; import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import storeOptions from '../stores/issue_notes_store'; import storeOptions from '../stores/issue_notes_store';
...@@ -39,6 +41,9 @@ export default { ...@@ -39,6 +41,9 @@ export default {
this.$store.dispatch('fetchNotes', path) this.$store.dispatch('fetchNotes', path)
.then(() => { .then(() => {
this.isLoading = false; this.isLoading = false;
})
.catch(() => {
new Flash('Something went wrong while fetching issue comments. Please try again.'); // eslint-disable-line
}); });
}, },
}; };
......
/* global Flash */
/* eslint-disable no-param-reassign */ /* eslint-disable no-param-reassign */
import service from '../services/issue_notes_service'; import service from '../services/issue_notes_service';
...@@ -52,9 +51,6 @@ const actions = { ...@@ -52,9 +51,6 @@ const actions = {
.then(res => res.json()) .then(res => res.json())
.then((res) => { .then((res) => {
context.commit('setNotes', res); context.commit('setNotes', res);
})
.catch(() => {
new Flash('Something went wrong while fetching issue comments. Please try again.'); // eslint-disable-line
}); });
}, },
deleteNote(context, note) { deleteNote(context, note) {
...@@ -62,9 +58,6 @@ const actions = { ...@@ -62,9 +58,6 @@ const actions = {
.deleteNote(note.path) .deleteNote(note.path)
.then(() => { .then(() => {
context.commit('deleteNote', note); context.commit('deleteNote', note);
})
.catch(() => {
new Flash('Something went wrong while deleting your note. Please try again.'); // eslint-disable-line
}); });
}, },
replyToDiscussion(context, data) { replyToDiscussion(context, data) {
...@@ -72,12 +65,9 @@ const actions = { ...@@ -72,12 +65,9 @@ const actions = {
return service return service
.replyToDiscussion(endpoint, reply) .replyToDiscussion(endpoint, reply)
.then((res) => res.json()) .then(res => res.json())
.then((res) => { .then((res) => {
context.commit('addNewReplyToDiscussion', res); context.commit('addNewReplyToDiscussion', res);
})
.catch(() => {
new Flash('Something went wrong while adding your reply. Please try again.'); // eslint-disable-line
}); });
}, },
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment