From 61d7dcf61b2f98c3c06b5485525e746aab744b6a Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Mon, 13 Jan 2020 23:46:31 -0500 Subject: [PATCH] Added AxiosStrategy and ProxyStrategy Network Strategies --- functions/strategies/AxiosStrategy.js | 8 ++++++++ functions/strategies/ProxyStrategy.js | 13 +++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 functions/strategies/AxiosStrategy.js create mode 100644 functions/strategies/ProxyStrategy.js diff --git a/functions/strategies/AxiosStrategy.js b/functions/strategies/AxiosStrategy.js new file mode 100644 index 00000000..5c802078 --- /dev/null +++ b/functions/strategies/AxiosStrategy.js @@ -0,0 +1,8 @@ +import axios from "axios"; + +const axiosStrategy = async (req, _store) => { + const res = await axios(req); + return res; +} + +export default axiosStrategy; diff --git a/functions/strategies/ProxyStrategy.js b/functions/strategies/ProxyStrategy.js new file mode 100644 index 00000000..9cac6f47 --- /dev/null +++ b/functions/strategies/ProxyStrategy.js @@ -0,0 +1,13 @@ +import axios from "axios"; + +const proxyStrategy = async (req, store) => { + const proxyRes = await axios.post( + store.state.postwoman.settings.PROXY_URL || + "https://postwoman.apollotv.xyz/", + req + ); + + return proxyRes.data; +} + +export default proxyStrategy;