Refactor to bring the nuxt loading bar code out of the strategies
This commit is contained in:
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user