chore: minor fixes and improvements

This commit is contained in:
liyasthomas
2021-10-16 20:54:19 +05:30
parent d9d7261bc5
commit 57c4759bdb
5 changed files with 24 additions and 32 deletions

View File

@@ -102,13 +102,13 @@ const client = createClient({
*/
export type GQLError<T extends string> =
| {
type: "network_error"
error: Error
}
type: "network_error"
error: Error
}
| {
type: "gql_error"
error: T
}
type: "gql_error"
error: T
}
const DEFAULT_QUERY_OPTIONS = {
noPolling: false,
@@ -124,10 +124,10 @@ type UseQueryLoading = {
type UseQueryLoaded<
QueryFailType extends string = "",
QueryReturnType = any
> = {
loading: false
data: E.Either<GQLError<QueryFailType>, QueryReturnType>
}
> = {
loading: false
data: E.Either<GQLError<QueryFailType>, QueryReturnType>
}
type UseQueryReturn<QueryFailType extends string = "", QueryReturnType = any> =
| UseQueryLoading
@@ -218,9 +218,9 @@ export function useGQLQuery<
data: data!,
}) as
| {
loading: false
data: DataType
}
loading: false
data: DataType
}
| { loading: true }
}