Commit f5acfbda authored by Bryce Johnson's avatar Bryce Johnson

Init Flash error message on approval api errors.

parent b37588bc
...@@ -14,20 +14,29 @@ ...@@ -14,20 +14,29 @@
} }
fetchApprovals() { fetchApprovals() {
const flashErrorMessage = 'An error occured while retrieving approval data for this merge request.';
return Vue.http.get(this.baseEndpoint).catch((err) => { return Vue.http.get(this.baseEndpoint).catch((err) => {
console.error(`Error fetching approvals. ${err}`); console.error('Error fetching approvals', err);
return new Flash(flashErrorMessage, 'alert');
}); });
} }
approveMergeRequest() { approveMergeRequest() {
const flashErrorMessage = 'An error occured while submitting your approval.';
return Vue.http.post(this.baseEndpoint).catch((err) => { return Vue.http.post(this.baseEndpoint).catch((err) => {
console.error(`Error approving merge request. ${err}`); console.error('Error approving merge request', err);
return new Flash(flashErrorMessage, 'alert');
}); });
} }
unapproveMergeRequest() { unapproveMergeRequest() {
const flashErrorMessage = 'An error occured while removing your approval.';
return Vue.http.delete(this.baseEndpoint).catch((err) => { return Vue.http.delete(this.baseEndpoint).catch((err) => {
console.error(`Error unapproving merge request. ${err}`); console.error('Error unapproving merge request', err);
return new Flash(flashErrorMessage, 'alert');
}); });
} }
} }
......
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