* Use FieldDefinition for company show page * removing console.log * fix conflicts * fix address placeholder + company show page field definition ordering * fix story * add replacePlaceholder * use AppPath enum in stories * add routeParams * fix people input story
48 lines
1013 B
TypeScript
48 lines
1013 B
TypeScript
import { gql } from '@apollo/client';
|
|
import { useSetRecoilState } from 'recoil';
|
|
|
|
import { genericEntitiesFamilyState } from '@/ui/editable-field/states/genericEntitiesFamilyState';
|
|
import { useGetCompanyQuery } from '~/generated/graphql';
|
|
|
|
export const GET_COMPANY = gql`
|
|
query GetCompany($where: CompanyWhereUniqueInput!) {
|
|
findUniqueCompany(where: $where) {
|
|
id
|
|
domainName
|
|
name
|
|
createdAt
|
|
address
|
|
linkedinUrl
|
|
employees
|
|
_activityCount
|
|
accountOwner {
|
|
id
|
|
email
|
|
displayName
|
|
avatarUrl
|
|
}
|
|
Favorite {
|
|
id
|
|
person {
|
|
id
|
|
}
|
|
company {
|
|
id
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export function useCompanyQuery(id: string) {
|
|
const updateCompanyShowPage = useSetRecoilState(
|
|
genericEntitiesFamilyState(id),
|
|
);
|
|
return useGetCompanyQuery({
|
|
variables: { where: { id } },
|
|
onCompleted: (data) => {
|
|
updateCompanyShowPage(data?.findUniqueCompany);
|
|
},
|
|
});
|
|
}
|