Refactor GraphqlPerson to GraphqlQueryPerson

A GraphqlQueryPerson has an id which is used in mutations.
This commit is contained in:
Anders Borch
2023-04-24 21:43:28 +02:00
parent b6c7149b66
commit 8ed09d61ef
5 changed files with 18 additions and 11 deletions

View File

@ -1,5 +1,5 @@
import { QueryResult, gql, useQuery } from '@apollo/client';
import { GraphqlPerson } from '../../interfaces/person.interface';
import { GraphqlQueryPerson } from '../../interfaces/person.interface';
export type OrderBy = Record<string, 'asc' | 'desc'>;
@ -14,6 +14,7 @@ export const GET_PEOPLE = gql`
lastname
created_at
company {
id
company_name
company_domain
}
@ -23,8 +24,8 @@ export const GET_PEOPLE = gql`
export function usePeopleQuery(
orderBy: OrderBy[],
): QueryResult<{ people: GraphqlPerson[] }> {
return useQuery<{ people: GraphqlPerson[] }>(GET_PEOPLE, {
): QueryResult<{ people: GraphqlQueryPerson[] }> {
return useQuery<{ people: GraphqlQueryPerson[] }>(GET_PEOPLE, {
variables: { orderBy },
});
}