fix: improper parsed error checks
This commit is contained in:
committed by
liyasthomas
parent
d94759870e
commit
5fa6c6cdb3
@@ -201,7 +201,7 @@ export const useGQLQuery = <DocType, DocVarType, DocErrorType extends string>(
|
|||||||
(gqlErr) =>
|
(gqlErr) =>
|
||||||
<GQLError<DocErrorType>>{
|
<GQLError<DocErrorType>>{
|
||||||
type: "gql_error",
|
type: "gql_error",
|
||||||
error: gqlErr as DocErrorType,
|
error: parseGQLErrorString(gqlErr ?? "") as DocErrorType,
|
||||||
},
|
},
|
||||||
// The right case (it was a GraphQL Error)
|
// The right case (it was a GraphQL Error)
|
||||||
(networkErr) =>
|
(networkErr) =>
|
||||||
@@ -244,6 +244,8 @@ export const useGQLQuery = <DocType, DocVarType, DocErrorType extends string>(
|
|||||||
return response
|
return response
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const parseGQLErrorString = (s: string) => s.startsWith("[GraphQL] ") ? s.split("[GraphQL] ")[1] : s
|
||||||
|
|
||||||
export const runMutation = <
|
export const runMutation = <
|
||||||
DocType,
|
DocType,
|
||||||
DocVariables extends object | undefined,
|
DocVariables extends object | undefined,
|
||||||
|
|||||||
Reference in New Issue
Block a user