Refactor parseErrorCode and try to decrease method complexity (#132)

This commit is contained in:
Nima 2019-10-10 07:11:18 +03:30 committed by Nithin David Thomas
parent 1625929193
commit df0c1fa0c5

View file

@ -4,13 +4,12 @@ import Auth from '../api/auth';
import router from '../routes';
const parseErrorCode = error => {
if (error.response) {
const errorStatus = error.response ? error.response.status : undefined;
// 901, 902 are used to identify billing related issues
if ([901, 902].includes(error.response.status)) {
if ([901, 902].includes(errorStatus)) {
const name = Auth.isAdmin() ? 'billing' : 'billing_deactivated';
router.push({ name });
}
}
return Promise.reject(error);
};