From 21144997d3ed20405a4d2af5548c76bacc4d3d89 Mon Sep 17 00:00:00 2001 From: mateuswetah Date: Fri, 17 May 2024 11:18:14 -0300 Subject: [PATCH] Fixes error warnings for role edition form. #870 --- src/views/admin/js/axios.js | 4 ++-- src/views/admin/js/store/modules/capability/actions.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) 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); }); }); };