Refactor to bring the nuxt loading bar code out of the strategies
This commit is contained in:
parent
2faf675c0a
commit
4b48d8a8c8
3 changed files with 9 additions and 4 deletions
|
|
@ -1,12 +1,19 @@
|
|||
import AxiosStrategy from "./strategies/AxiosStrategy";
|
||||
import ProxyStrategy from "./strategies/ProxyStrategy";
|
||||
import FirefoxStrategy from "./strategies/FirefoxStrategy";
|
||||
|
||||
|
||||
const runAppropriateStrategy = (req, store) => {
|
||||
|
||||
const sendNetworkRequest = (req, store) => {
|
||||
if (store.state.postwoman.settings.PROXY_ENABLED) {
|
||||
return ProxyStrategy(req, store);
|
||||
}
|
||||
|
||||
return AxiosStrategy(req, store);
|
||||
};
|
||||
}
|
||||
|
||||
const sendNetworkRequest = (req, store) =>
|
||||
runAppropriateStrategy(req, store)
|
||||
.finally(() => window.$nuxt.$loading.finish());
|
||||
|
||||
export { sendNetworkRequest };
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import axios from "axios";
|
|||
|
||||
const axiosStrategy = async (req, _store) => {
|
||||
const res = await axios(req);
|
||||
window.$nuxt.$loading.finish();
|
||||
return res;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ const proxyStrategy = async (req, store) => {
|
|||
"https://postwoman.apollotv.xyz/",
|
||||
req
|
||||
);
|
||||
window.$nuxt.$loading.finish();
|
||||
return data;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue