Skip to content

The open alternative to Salesforce, designed for AI.

refactor: etract type in file

Sammy Teilletd5ebff5b5386
diff --git a/front/src/pages/people/People.tsx b/front/src/pages/people/People.tsx
index 2ed82b8f941..c1b18ef9cb2 100644
--- a/front/src/pages/people/People.tsx
+++ b/front/src/pages/people/People.tsx
@@ -4,7 +4,7 @@ import Table from '../../components/table/Table';
import styled from '@emotion/styled';
import { peopleColumns } from './people-table';
import { gql, useQuery } from '@apollo/client';
-import { Person } from './types';
+import { GraphqlPerson, Person } from './types';
import { defaultData } from './defaultData';
const StyledPeopleContainer = styled.div`
@@ -30,24 +30,8 @@ const GET_PEOPLE = gql`
}
`;
-type QueryResult = {
- city: string;
- company: {
- __typename: string;
- company_name: string;
- company_domain: string;
- };
- created_at: string;
- email: string;
- firstname: string;
- id: number;
- lastname: string;
- phone: string;
- __typename: string;
-};
-
function People() {
- const { data } = useQuery<{ person: QueryResult[] }>(GET_PEOPLE);
+ const { data } = useQuery<{ person: GraphqlPerson[] }>(GET_PEOPLE);
const mydata: Person[] = data
? data.person.map((person) => ({
diff --git a/front/src/pages/people/types.ts b/front/src/pages/people/types.ts
index af30e6c53ab..4afd0aeaec4 100644
--- a/front/src/pages/people/types.ts
+++ b/front/src/pages/people/types.ts
@@ -12,3 +12,19 @@ export type Person = {
city: string;
countryCode: string;
};
+
+export type GraphqlPerson = {
+ city: string;
+ company: {
+ __typename: string;
+ company_name: string;
+ company_domain: string;
+ };
+ created_at: string;
+ email: string;
+ firstname: string;
+ id: number;
+ lastname: string;
+ phone: string;
+ __typename: string;
+};