diff --git a/src/views/admin/js/axios.js b/src/views/admin/js/axios.js index ac23f2968..d5bd350f8 100644 --- a/src/views/admin/js/axios.js +++ b/src/views/admin/js/axios.js @@ -38,12 +38,12 @@ export const tainacanErrorHandler = function(error) { console.log('Tainacan Error Handler: ', error.response); } - } else if ('Tainacan Error Handler: ', error.request) { + } else if ( error.request ) { // The request was made but no response was received // `error.request` is an instance of XMLHttpRequest in the browser and an instance of // http.ClientRequest in node.js console.error('Tainacan Error Handler: ', error.request); - } else { + } else if ( error.message ) { // Something happened in setting up the request that triggered an Error console.error('Tainacan Error Handler: ', error.message); } diff --git a/src/views/admin/js/store/modules/capability/actions.js b/src/views/admin/js/store/modules/capability/actions.js index 1e774c1a2..4c438234c 100644 --- a/src/views/admin/js/store/modules/capability/actions.js +++ b/src/views/admin/js/store/modules/capability/actions.js @@ -69,8 +69,8 @@ export const createRole = ({ commit }, role) => { resolve(role); }) .catch((error) => { - if (error.response) - reject(error.response.data); + if (error.error && error.error.response && error.error.response.data) + reject(error.error.response.data); }); }); }; @@ -86,8 +86,8 @@ export const updateRole = ({ commit }, role) => { resolve(updatedRole); }) .catch(error => { - if (error.response) - reject(error.response.data); + if (error.error && error.error.response && error.error.response.data) + reject(error.error.response.data); }); }); };