Sammy/t refactor services use generated code (#194)

* refactor: use generated queries for Companies

* refactor: remove useQuery from service, use generated code

* refactor: rename to ts file instead of tsx

* bugfix: use generatd queries, and fix non existing id in workspace member query
This commit is contained in:
Sammy Teillet
2023-06-05 17:36:14 +02:00
committed by GitHub
parent fe70f30a29
commit 063ef8a4eb
11 changed files with 27 additions and 31 deletions

View File

@ -33,7 +33,7 @@ export type GraphqlQueryPerson = {
company?: GraphqlQueryCompany | null;
__typename: string;
__typename?: string;
};
export type GraphqlMutationPerson = {

View File

@ -1,14 +1,13 @@
import { gql, QueryResult, useQuery } from '@apollo/client';
import { gql } from '@apollo/client';
import { SelectedSortType } from '@/filters-and-sorts/interfaces/sorts/interface';
import {
PersonOrderByWithRelationInput as People_Order_By,
PersonWhereInput as People_Bool_Exp,
SortOrder,
useGetPeopleQuery,
} from '~/generated/graphql';
import { GraphqlQueryPerson } from '../interfaces/person.interface';
export type PeopleSelectedSortType = SelectedSortType<People_Order_By>;
export const GET_PEOPLE = gql`
@ -37,8 +36,8 @@ export const GET_PEOPLE = gql`
export function usePeopleQuery(
orderBy: People_Order_By[],
where: People_Bool_Exp,
): QueryResult<{ people: GraphqlQueryPerson[] }> {
return useQuery<{ people: GraphqlQueryPerson[] }>(GET_PEOPLE, {
) {
return useGetPeopleQuery({
variables: { orderBy, where },
});
}