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:
@ -33,7 +33,7 @@ export type GraphqlQueryPerson = {
|
||||
|
||||
company?: GraphqlQueryCompany | null;
|
||||
|
||||
__typename: string;
|
||||
__typename?: string;
|
||||
};
|
||||
|
||||
export type GraphqlMutationPerson = {
|
||||
|
||||
@ -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 },
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user