fix: response time for requests via extension has incorrect value (#2921)

Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
This commit is contained in:
Jesvin Jose
2023-02-17 19:14:50 +05:30
committed by GitHub
parent 2545262fc2
commit 82c6f6f6bc
3 changed files with 10 additions and 11 deletions

View File

@@ -274,6 +274,10 @@ import { createShortcode } from "~/helpers/backend/mutations/Shortcode"
import { runMutation } from "~/helpers/backend/GQLClient"
import { UpdateRequestDocument } from "~/helpers/backend/graphql"
import { getPlatformSpecialKey as getSpecialKey } from "~/helpers/platformutils"
import {
cancelRunningExtensionRequest,
hasExtensionInstalled,
} from "~/helpers/strategies/ExtensionStrategy"
const t = useI18n()
@@ -403,6 +407,9 @@ function isCURL(curl: string) {
const cancelRequest = () => {
loading.value = false
if (hasExtensionInstalled()) {
cancelRunningExtensionRequest()
}
updateRESTResponse(null)
}

View File

@@ -16,7 +16,7 @@ export const hasFirefoxExtensionInstalled = () =>
hasExtensionInstalled() && browserIsFirefox()
export const cancelRunningExtensionRequest = () => {
window.__POSTWOMAN_EXTENSION_HOOK__?.cancelRunningRequest()
window.__POSTWOMAN_EXTENSION_HOOK__?.cancelRequest()
}
export const defineSubscribableObject = <T extends object>(obj: T) => {

View File

@@ -8,7 +8,7 @@ interface PWExtensionHook {
sendRequest: (
req: AxiosRequestConfig & { wantsBinary: boolean }
) => Promise<NetworkResponse>
cancelRunningRequest: () => void
cancelRequest: () => void
}
type HoppExtensionStatusHook = {
@@ -18,17 +18,9 @@ type HoppExtensionStatusHook = {
}
subscribe(prop: "status", func: (...args: any[]) => any): void
}
declare global {
export declare global {
interface Window {
__POSTWOMAN_EXTENSION_HOOK__: PWExtensionHook | undefined
__HOPP_EXTENSION_STATUS_PROXY__: HoppExtensionStatusHook | undefined
}
}
// Vue builtins
declare module '*.vue' {
import type { DefineComponent } from 'vue'
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
const component: DefineComponent<{}, {}, any>
export default component
}