feat: gql revamp (#2644)
Co-authored-by: Liyas Thomas <liyascthomas@gmail.com> Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
This commit is contained in:
33
packages/hoppscotch-common/src/helpers/graphql/default.ts
Normal file
33
packages/hoppscotch-common/src/helpers/graphql/default.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { parse, print } from "graphql"
|
||||
import { HoppGQLRequest, GQL_REQ_SCHEMA_VERSION } from "@hoppscotch/data"
|
||||
|
||||
const DEFAULT_QUERY = print(
|
||||
parse(
|
||||
`
|
||||
query Request {
|
||||
method
|
||||
url
|
||||
headers {
|
||||
key
|
||||
value
|
||||
}
|
||||
}
|
||||
`,
|
||||
{ allowLegacyFragmentVariables: true }
|
||||
)
|
||||
)
|
||||
|
||||
export const getDefaultGQLRequest = (): HoppGQLRequest => ({
|
||||
v: GQL_REQ_SCHEMA_VERSION,
|
||||
name: "Untitled",
|
||||
url: "https://echo.hoppscotch.io/graphql",
|
||||
headers: [],
|
||||
variables: `{
|
||||
"id": "1"
|
||||
}`,
|
||||
query: DEFAULT_QUERY,
|
||||
auth: {
|
||||
authType: "none",
|
||||
authActive: true,
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user