-
Notifications
You must be signed in to change notification settings - Fork 53
/
fetch-user.generated.ts
80 lines (76 loc) · 2.15 KB
/
fetch-user.generated.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/* eslint-disable */
import * as Types from "@/graphql/graphql";
import { gql } from "@apollo/client";
import * as Apollo from "@apollo/client";
const defaultOptions = {} as const;
export type FetchUserQueryVariables = Types.Exact<{
id: Types.Scalars["String"];
}>;
export type FetchUserQuery = {
__typename?: "query_root";
user: Array<{
__typename?: "user";
id: string;
email?: string | null;
name: string;
team: { __typename?: "team"; id: string; name?: string | null };
}>;
};
export const FetchUserDocument = gql`
query FetchUser($id: String!) {
user(where: { id: { _eq: $id } }) {
id
email
name
team {
id
name
}
}
}
`;
/**
* __useFetchUserQuery__
*
* To run a query within a React component, call `useFetchUserQuery` and pass it any options that fit your needs.
* When your component renders, `useFetchUserQuery` returns an object from Apollo Client that contains loading, error, and data properties
* you can use to render your UI.
*
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
*
* @example
* const { data, loading, error } = useFetchUserQuery({
* variables: {
* id: // value for 'id'
* },
* });
*/
export function useFetchUserQuery(
baseOptions: Apollo.QueryHookOptions<FetchUserQuery, FetchUserQueryVariables>
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useQuery<FetchUserQuery, FetchUserQueryVariables>(
FetchUserDocument,
options
);
}
export function useFetchUserLazyQuery(
baseOptions?: Apollo.LazyQueryHookOptions<
FetchUserQuery,
FetchUserQueryVariables
>
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<FetchUserQuery, FetchUserQueryVariables>(
FetchUserDocument,
options
);
}
export type FetchUserQueryHookResult = ReturnType<typeof useFetchUserQuery>;
export type FetchUserLazyQueryHookResult = ReturnType<
typeof useFetchUserLazyQuery
>;
export type FetchUserQueryResult = Apollo.QueryResult<
FetchUserQuery,
FetchUserQueryVariables
>;