diff options
Diffstat (limited to 'app/assets/javascripts/deploy_freeze/store/actions.js')
-rw-r--r-- | app/assets/javascripts/deploy_freeze/store/actions.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/app/assets/javascripts/deploy_freeze/store/actions.js b/app/assets/javascripts/deploy_freeze/store/actions.js index fed80b46eda..1ac6781a0e3 100644 --- a/app/assets/javascripts/deploy_freeze/store/actions.js +++ b/app/assets/javascripts/deploy_freeze/store/actions.js @@ -1,5 +1,6 @@ import Api from '~/api'; import createFlash from '~/flash'; +import { logError } from '~/lib/logger'; import { __ } from '~/locale'; import * as types from './mutation_types'; @@ -52,6 +53,21 @@ export const updateFreezePeriod = (store) => }), ); +export const deleteFreezePeriod = ({ state, commit }, { id }) => { + commit(types.REQUEST_DELETE_FREEZE_PERIOD, id); + + return Api.deleteFreezePeriod(state.projectId, id) + .then(() => commit(types.RECEIVE_DELETE_FREEZE_PERIOD_SUCCESS, id)) + .catch((e) => { + createFlash({ + message: __('Error: Unable to delete deploy freeze'), + }); + commit(types.RECEIVE_DELETE_FREEZE_PERIOD_ERROR, id); + + logError(`Unable to delete deploy freeze`, e); + }); +}; + export const fetchFreezePeriods = ({ commit, state }) => { commit(types.REQUEST_FREEZE_PERIODS); |