♻️ Refactor

This commit is contained in:
Liyas Thomas
2020-01-19 12:37:19 +05:30
parent d9feffa630
commit 5458debe35
6 changed files with 53 additions and 51 deletions

View File

@@ -1,13 +1,12 @@
import axios from "axios";
const axiosWithProxy = async (req, store) => {
const axiosWithProxy = async (req, { state }) => {
const { data } = await axios.post(
store.state.postwoman.settings.PROXY_URL ||
"https://postwoman.apollotv.xyz/",
state.postwoman.settings.PROXY_URL || "https://postwoman.apollotv.xyz/",
req
);
return data;
}
};
const axiosWithoutProxy = async (req, _store) => {
const res = await axios(req);
@@ -19,6 +18,6 @@ const axiosStrategy = (req, store) => {
return axiosWithProxy(req, store);
}
return axiosWithoutProxy(req, store);
}
};
export default axiosStrategy;