diff options
Diffstat (limited to 'app/assets/javascripts/notes/stores/actions.js')
-rw-r--r-- | app/assets/javascripts/notes/stores/actions.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/assets/javascripts/notes/stores/actions.js b/app/assets/javascripts/notes/stores/actions.js index 1ad7648e533..bb9c2c53b79 100644 --- a/app/assets/javascripts/notes/stores/actions.js +++ b/app/assets/javascripts/notes/stores/actions.js @@ -87,7 +87,7 @@ export const saveNote = ({ commit, dispatch }, noteData) => { const commandsChanges = res.commands_changes; if (hasQuickActions && Object.keys(errors).length) { - dispatch('poll'); + dispatch('fetchData'); $('.js-gfm-input').trigger('clear-commands-cache.atwho'); Flash('Commands applied', 'notice', $(noteData.flashContainer)); @@ -186,6 +186,15 @@ export const poll = ({ commit, state, getters }) => { }); }; +export const fetchData = ({ commit, state, getters }) => { + const requestData = { endpoint: state.notesData.notesPath, lastFetchedAt: state.lastFetchedAt }; + + service.poll(requestData) + .then(resp => resp.json) + .then(data => pollSuccessCallBack(data, commit, state, getters)) + .catch(() => Flash('Something went wrong while fetching latest comments.')); +}; + export const toggleAward = ({ commit, state, getters, dispatch }, { awardName, noteId }) => { commit(types.TOGGLE_AWARD, { awardName, note: getters.notesById[noteId] }); }; |