From 3726f0a376c121c66115a65ce46d29aef39d0e05 Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Mon, 13 Jan 2020 23:47:28 -0500 Subject: [PATCH] Added sendNetworkRequest to detect appropriate strategy and use it --- functions/network.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 functions/network.js diff --git a/functions/network.js b/functions/network.js new file mode 100644 index 000000000..f2089363e --- /dev/null +++ b/functions/network.js @@ -0,0 +1,13 @@ +import AxiosStrategy from "./strategies/AxiosStrategy"; +import ProxyStrategy from "./strategies/ProxyStrategy"; + + +const sendNetworkRequest = (req, store) => { + if (store.state.postwoman.settings.PROXY_ENABLED) { + return ProxyStrategy(req, store); + } else { + return AxiosStrategy(req, store); + } +} + +export { sendNetworkRequest };