Added cancellable requests support for ExtensionStrategy

This commit is contained in:
Andrew Bastin
2020-05-30 18:26:51 -04:00
parent b2600d3ffd
commit 62c3b341bb

View File

@@ -7,6 +7,12 @@ export const hasChromeExtensionInstalled = () =>
export const hasFirefoxExtensionInstalled = () =>
hasExtensionInstalled() && /Firefox/i.test(navigator.userAgent)
export const cancelRunningExtensionRequest = () => {
if (hasExtensionInstalled() && window.__POSTWOMAN_EXTENSION_HOOK__.cancelRunningRequest) {
window.__POSTWOMAN_EXTENSION_HOOK__.cancelRunningRequest()
}
}
const extensionWithProxy = async (req, { state }) => {
const { data } = await window.__POSTWOMAN_EXTENSION_HOOK__.sendRequest({
method: "post",