diff options
author | Phil Hughes <me@iamphill.com> | 2018-05-11 10:37:10 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-05-25 12:55:37 +0100 |
commit | a57e43dd8cf29b7574fcab63948fa2aaca1c00b7 (patch) | |
tree | f1c7fe9289659459d243876c73c0b6b7f1b0d622 /app/assets/javascripts/ide/stores/modules/merge_requests/actions.js | |
parent | d6a7a111ff3cc0bd4681615fc97c7b2a90729444 (diff) | |
download | gitlab-ce-a57e43dd8cf29b7574fcab63948fa2aaca1c00b7.tar.gz |
Show merge requests in web IDE
Closes #45184
Diffstat (limited to 'app/assets/javascripts/ide/stores/modules/merge_requests/actions.js')
-rw-r--r-- | app/assets/javascripts/ide/stores/modules/merge_requests/actions.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/app/assets/javascripts/ide/stores/modules/merge_requests/actions.js b/app/assets/javascripts/ide/stores/modules/merge_requests/actions.js new file mode 100644 index 00000000000..856be0d73cd --- /dev/null +++ b/app/assets/javascripts/ide/stores/modules/merge_requests/actions.js @@ -0,0 +1,22 @@ +import { __ } from '../../../../locale'; +import Api from '../../../../api'; +import flash from '../../../../flash'; +import * as types from './mutation_types'; + +export const requestMergeRequests = ({ commit }) => commit(types.REQUEST_MERGE_REQUESTS); +export const receiveMergeRequestsError = ({ commit }) => { + flash(__('Error loading merge requests.')); + commit(types.RECEIVE_MERGE_REQUESTS_ERROR); +}; +export const receiveMergeRequestsSuccess = ({ commit }, data) => + commit(types.RECEIVE_MERGE_REQUESTS_SUCCESS, data); + +export const fetchMergeRequests = ({ dispatch, state }) => { + dispatch('requestMergeRequests'); + + Api.mergeRequests({ scope: state.scope, view: 'simple' }) + .then(({ data }) => { + dispatch('receiveMergeRequestsSuccess', data); + }) + .catch(() => dispatch('receiveMergeRequestsError')); +}; |