From a3128cee3579111d9dec472176e6a4c35dce9507 Mon Sep 17 00:00:00 2001 From: Pranav Raj Sreepuram Date: Thu, 5 Sep 2019 13:18:27 +0530 Subject: [PATCH] Remove unused http error codes --- app/javascript/src/helper/APIHelper.js | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/app/javascript/src/helper/APIHelper.js b/app/javascript/src/helper/APIHelper.js index a37be9d37..9b0e7fac3 100644 --- a/app/javascript/src/helper/APIHelper.js +++ b/app/javascript/src/helper/APIHelper.js @@ -5,26 +5,12 @@ import router from '../routes'; const parseErrorCode = error => { if (error.response) { - if (error.response.status === 401) { - // If auth failed - } else if (error.response.status === 500) { - // If server failed - } else if (error.response.status === 422) { - // If request params are errored - } else if (error.response.status === 901 || error.response.status === 902) { - let name = 'billing_deactivated'; - if (Auth.isAdmin()) { - name = 'billing'; - } - // If Trial ended + // 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 }); - } else { - // Anything else } - } else { - // Something happened in setting up the request that triggered an Error } - // Do something with request error return Promise.reject(error); };