diff --git a/public/js/app.js b/public/js/app.js index 11b72d6..8e47f3c 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -154,19 +154,15 @@ class Form { * @param {string} url */ submit(requestType, url) { - return new Promise((resolve, reject) => { - axios[requestType](url, this.data()) - .then(response => { - this.onSuccess(response.data); - - resolve(response.data); - }) - .catch(error => { - this.onFail(error.response.data); - - reject(error.response.data); - }); - }); + return axios[requestType](url, this.data()) + .then(response => { + this.onSuccess(response.data); + return response.data; + }) + .catch(error => { + this.onFail(error.response.data); + throw error.response.data; + }); }