diff --git a/app/javascript/src/helper/APIHelper.js b/app/javascript/src/helper/APIHelper.js index 9b0e7fac3..a37afb103 100644 --- a/app/javascript/src/helper/APIHelper.js +++ b/app/javascript/src/helper/APIHelper.js @@ -4,12 +4,11 @@ import Auth from '../api/auth'; import router from '../routes'; const parseErrorCode = error => { - if (error.response) { - // 901, 902 are used to identify billing related issues - if ([901, 902].includes(error.response.status)) { - const name = Auth.isAdmin() ? 'billing' : 'billing_deactivated'; - router.push({ name }); - } + const errorStatus = error.response ? error.response.status : undefined; + // 901, 902 are used to identify billing related issues + if ([901, 902].includes(errorStatus)) { + const name = Auth.isAdmin() ? 'billing' : 'billing_deactivated'; + router.push({ name }); } return Promise.reject(error); };