From 55ac094fc4fbdd227566b58bd0ee8dbf06e0793d Mon Sep 17 00:00:00 2001 From: Fine Date: Mon, 21 Apr 2025 22:21:31 +0800 Subject: [PATCH] update --- src/graphql/base.ts | 6 ++++++ src/graphql/fetch.ts | 3 +-- src/graphql/index.ts | 3 +-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/graphql/base.ts b/src/graphql/base.ts index 416d0711..8ace7bc3 100644 --- a/src/graphql/base.ts +++ b/src/graphql/base.ts @@ -17,6 +17,12 @@ * under the License. */ +type GraphQLErrors = Array<{ message: string }>; +type GraphQLResponse = { + data?: T; + errors?: GraphQLErrors; +}; + export let globalAbortController = new AbortController(); export function abortRequestsAndUpdate() { globalAbortController.abort(); diff --git a/src/graphql/fetch.ts b/src/graphql/fetch.ts index 5cc73b11..f475c6a4 100644 --- a/src/graphql/fetch.ts +++ b/src/graphql/fetch.ts @@ -14,14 +14,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { cancelToken } from "@/utils/cancelToken"; import { httpQuery } from "./base"; async function fetchQuery(param: { queryStr: string; conditions: { [key: string]: unknown } }) { const response = await httpQuery({ method: "post", json: { query: param.queryStr, variables: { ...param.conditions } }, - headers: { cancelToken: cancelToken() }, + headers: {}, }); if (response.errors) { response.errors = response.errors.map((e: { message: string }) => e.message).join(" "); diff --git a/src/graphql/index.ts b/src/graphql/index.ts index bbd6c52f..89cef044 100644 --- a/src/graphql/index.ts +++ b/src/graphql/index.ts @@ -15,7 +15,6 @@ * limitations under the License. */ import { httpQuery } from "./base"; -import { cancelToken } from "@/utils/cancelToken"; import * as app from "./query/app"; import * as selector from "./query/selector"; import * as dashboard from "./query/dashboard"; @@ -52,7 +51,7 @@ class Graphql { public params(variables: unknown) { return httpQuery({ method: "post", - headers: { cancelToken: cancelToken() }, + headers: {}, json: { query: query[this.queryData], variables,