refactor: gql request object and history typing updates

This commit is contained in:
Andrew Bastin
2021-08-24 21:58:04 +05:30
parent c5f8ab3394
commit d1b2539d67
11 changed files with 240 additions and 107 deletions

View File

@@ -291,9 +291,10 @@ import {
} from "~/newstore/GQLSession"
import { commonHeaders } from "~/helpers/headers"
import { GQLConnection } from "~/helpers/GQLConnection"
import { addGraphqlHistoryEntry } from "~/newstore/history"
import { makeGQLHistoryEntry, addGraphqlHistoryEntry } from "~/newstore/history"
import { logHoppRequestRunToAnalytics } from "~/helpers/fb/analytics"
import { getCurrentStrategyID } from "~/helpers/network"
import { makeGQLRequest } from "~/helpers/types/HoppGQLRequest"
export default defineComponent({
props: {
@@ -377,20 +378,19 @@ export default defineComponent({
response.value = JSON.stringify(JSON.parse(responseText), null, 2)
const historyEntry = {
url: runURL,
query: runQuery,
variables: runVariables,
star: false,
headers: runHeaders,
response: response.value,
date: new Date().toLocaleDateString(),
time: new Date().toLocaleTimeString(),
updatedOn: new Date(),
duration,
}
addGraphqlHistoryEntry(historyEntry)
addGraphqlHistoryEntry(
makeGQLHistoryEntry({
request: makeGQLRequest({
name: "",
url: runURL,
query: runQuery,
headers: runHeaders,
variables: runVariables,
}),
response: response.value,
star: false,
})
)
$toast.success(t("state.finished_in", { duration }).toString(), {
icon: "done",

View File

@@ -213,10 +213,10 @@ import {
import { GraphQLField, GraphQLType } from "graphql"
import { map } from "rxjs/operators"
import { GQLConnection } from "~/helpers/GQLConnection"
import { GQLHeader } from "~/helpers/types/HoppGQLRequest"
import { copyToClipboard } from "~/helpers/utils/clipboard"
import { useReadonlyStream } from "~/helpers/utils/composables"
import {
GQLHeader,
setGQLHeaders,
setGQLQuery,
setGQLResponse,