Refactor parseErrorCode and try to decrease method complexity (#132)
This commit is contained in:
committed by
Nithin David Thomas
parent
1625929193
commit
df0c1fa0c5
@@ -4,12 +4,11 @@ import Auth from '../api/auth';
|
|||||||
import router from '../routes';
|
import router from '../routes';
|
||||||
|
|
||||||
const parseErrorCode = error => {
|
const parseErrorCode = error => {
|
||||||
if (error.response) {
|
const errorStatus = error.response ? error.response.status : undefined;
|
||||||
// 901, 902 are used to identify billing related issues
|
// 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';
|
const name = Auth.isAdmin() ? 'billing' : 'billing_deactivated';
|
||||||
router.push({ name });
|
router.push({ name });
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user