diff --git a/src/libs/HttpUtils.js b/src/libs/HttpUtils.js index 3359abe01373..4c8fe2ee6b30 100644 --- a/src/libs/HttpUtils.js +++ b/src/libs/HttpUtils.js @@ -5,12 +5,11 @@ import CONFIG from '../CONFIG'; import CONST from '../CONST'; import ONYXKEYS from '../ONYXKEYS'; import HttpsError from './Errors/HttpsError'; -import shouldUseStagingServer from './shouldUseStagingServer'; -let stagingServerToggleState = false; +let shouldUseStagingServer = false; Onyx.connect({ key: ONYXKEYS.USER, - callback: val => stagingServerToggleState = lodashGet(val, 'shouldUseStagingServer', true), + callback: val => shouldUseStagingServer = lodashGet(val, 'shouldUseStagingServer', true), }); let shouldFailAllRequests = false; @@ -99,7 +98,7 @@ function xhr(command, data, type = CONST.NETWORK.METHOD.POST, shouldUseSecure = let apiRoot = shouldUseSecure ? CONFIG.EXPENSIFY.SECURE_EXPENSIFY_URL : CONFIG.EXPENSIFY.URL_API_ROOT; - if (shouldUseStagingServer(stagingServerToggleState)) { + if (CONFIG.IS_IN_STAGING && shouldUseStagingServer) { apiRoot = shouldUseSecure ? CONFIG.EXPENSIFY.STAGING_SECURE_EXPENSIFY_URL : CONFIG.EXPENSIFY.STAGING_EXPENSIFY_URL; } diff --git a/src/libs/shouldUseStagingServer/index.js b/src/libs/shouldUseStagingServer/index.js deleted file mode 100644 index 745dd03b4489..000000000000 --- a/src/libs/shouldUseStagingServer/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import CONFIG from '../../CONFIG'; - -/** - * Helper method used to decide which API endpoint to call - * - * @param {Boolean} stagingServerToggleState - * @returns {Boolean} - */ -function shouldUseStagingServer(stagingServerToggleState) { - return CONFIG.IS_IN_STAGING && stagingServerToggleState; -} - -export default shouldUseStagingServer; diff --git a/src/libs/shouldUseStagingServer/index.native.js b/src/libs/shouldUseStagingServer/index.native.js deleted file mode 100644 index 8c660f9089f7..000000000000 --- a/src/libs/shouldUseStagingServer/index.native.js +++ /dev/null @@ -1,7 +0,0 @@ -/* - * @param {Boolean} stagingServerToggleState - * @returns {Boolean} - */ -export default function shouldUseStagingServer(stagingServerToggleState) { - return stagingServerToggleState; -}