Refactor parseErrorCode and try to decrease method complexity (#132)
This commit is contained in:
parent
1625929193
commit
df0c1fa0c5
1 changed files with 5 additions and 6 deletions
|
@ -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);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue