🚨 Lint
This commit is contained in:
@@ -1,16 +1,17 @@
|
||||
import AxiosStrategy from "./strategies/AxiosStrategy";
|
||||
import ExtensionStrategy from "./strategies/ExtensionStrategy";
|
||||
import FirefoxStrategy from "./strategies/FirefoxStrategy";
|
||||
import ChromeStrategy, { hasChromeExtensionInstalled } from "./strategies/ChromeStrategy";
|
||||
import ChromeStrategy, {
|
||||
hasChromeExtensionInstalled
|
||||
} from "./strategies/ChromeStrategy";
|
||||
|
||||
const isExtensionsAllowed = ({ state }) => {
|
||||
return typeof state.postwoman.settings.EXTENSIONS_ENABLED === 'undefined'
|
||||
|| state.postwoman.settings.EXTENSIONS_ENABLED;
|
||||
}
|
||||
const isExtensionsAllowed = ({ state }) =>
|
||||
typeof state.postwoman.settings.EXTENSIONS_ENABLED === "undefined" ||
|
||||
state.postwoman.settings.EXTENSIONS_ENABLED;
|
||||
|
||||
const runAppropriateStrategy = (req, store) => {
|
||||
if (isExtensionsAllowed(store)) {
|
||||
if (typeof window.__POSTWOMAN_EXTENSION_HOOK__ !== 'undefined') {
|
||||
if (typeof window.__POSTWOMAN_EXTENSION_HOOK__ !== "undefined") {
|
||||
return ExtensionStrategy(req, store);
|
||||
}
|
||||
|
||||
@@ -19,7 +20,7 @@ const runAppropriateStrategy = (req, store) => {
|
||||
// Chrome Provides a chrome object for scripts to access
|
||||
// Check its availability to say whether you are in Google Chrome
|
||||
if (window.chrome && hasChromeExtensionInstalled()) {
|
||||
return ChromeStrategy(req, store);
|
||||
return ChromeStrategy(req, store);
|
||||
}
|
||||
// The firefox plugin injects a function to send requests through it
|
||||
// If that is available, then we can use the FirefoxStrategy
|
||||
@@ -29,10 +30,11 @@ const runAppropriateStrategy = (req, store) => {
|
||||
}
|
||||
|
||||
return AxiosStrategy(req, store);
|
||||
}
|
||||
};
|
||||
|
||||
const sendNetworkRequest = (req, store) =>
|
||||
runAppropriateStrategy(req, store)
|
||||
.finally(() => window.$nuxt.$loading.finish());
|
||||
runAppropriateStrategy(req, store).finally(() =>
|
||||
window.$nuxt.$loading.finish()
|
||||
);
|
||||
|
||||
export { sendNetworkRequest };
|
||||
|
||||
Reference in New Issue
Block a user