Merge pull request #579 from liyasthomas/master

Even
This commit is contained in:
Liyas Thomas
2020-02-20 08:45:15 +05:30
committed by GitHub
2 changed files with 29 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
const extensionWithProxy = async (req, { state }) => {
const { data } = await window.__POSTWOMAN_EXTENSION_HOOK__.sendRequest({
method: "post",
url: state.postwoman.settings.PROXY_URL || "https://postwoman.apollotv.xyz/",
data: req
});
return data;
};
const extensionWithoutProxy = async (req, _store) => {
const res = await window.__POSTWOMAN_EXTENSION_HOOK__.sendRequest(req);
return res;
};
const extensionStrategy = (req, store) => {
if (store.state.postwoman.settings.PROXY_ENABLED) {
return extensionWithProxy(req, store);
}
return extensionWithoutProxy(req, store);
};
export default extensionStrategy;