Commit 34ac2c84 authored by Thomas Randolph's avatar Thomas Randolph

Remove action error handling so errors can be handled inline

parent 2134f964
......@@ -37,17 +37,12 @@ export const postRuleSuccess = ({ dispatch }) => {
dispatch('fetchRules');
};
export const postRuleError = () => {
createFlash(__('An error occurred while updating approvers'));
};
export const postRule = ({ rootState, dispatch }, rule) => {
const { rulesPath } = rootState.settings;
return axios
.post(rulesPath, mapApprovalRuleRequest(rule))
.then(() => dispatch('postRuleSuccess'))
.catch(() => dispatch('postRuleError'));
.then(() => dispatch('postRuleSuccess'));
};
export const putRule = ({ rootState, dispatch }, { id, ...newRule }) => {
......@@ -55,8 +50,7 @@ export const putRule = ({ rootState, dispatch }, { id, ...newRule }) => {
return axios
.put(`${rulesPath}/${id}`, mapApprovalRuleRequest(newRule))
.then(() => dispatch('postRuleSuccess'))
.catch(() => dispatch('postRuleError'));
.then(() => dispatch('postRuleSuccess'));
};
export const deleteRuleSuccess = ({ dispatch }) => {
......@@ -82,17 +76,12 @@ export const putFallbackRuleSuccess = ({ dispatch }) => {
dispatch('fetchRules');
};
export const putFallbackRuleError = () => {
createFlash(__('An error occurred while saving the approval settings'));
};
export const putFallbackRule = ({ rootState, dispatch }, fallback) => {
const { projectPath } = rootState.settings;
return axios
.put(projectPath, mapApprovalFallbackRuleRequest(fallback))
.then(() => dispatch('putFallbackRuleSuccess'))
.catch(() => dispatch('putFallbackRuleError'));
.then(() => dispatch('putFallbackRuleSuccess'));
};
export const requestEditRule = ({ dispatch }, rule) => {
......
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