diff --git a/package.json b/package.json index beee60d..5ef591e 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "evo_calculator", "private": true, "dependencies": { - "@apollo/client": "^3.2.5", + "@apollo/client": "^3.3.4", "@babel/code-frame": "^7.10.4", "@babel/helper-split-export-declaration": "^7.11.0", "@craco/craco": "^5.8.0", diff --git a/src/client/services/CrmService/client.ts b/src/client/services/CrmService/client.ts index dd4a22a..37ef0ae 100644 --- a/src/client/services/CrmService/client.ts +++ b/src/client/services/CrmService/client.ts @@ -1,19 +1,10 @@ -import { ApolloClient, InMemoryCache, HttpLink } from '@apollo/client'; +import { ApolloClient, InMemoryCache } from '@apollo/client'; import { getServerUrl } from 'client/common/urls'; -import { CRM_URL, CRM_PROXY_URL } from 'core/constants/urls'; +import { CRM_PROXY_URL } from 'core/constants/urls'; export default new ApolloClient({ - uri: CRM_URL, + uri: getServerUrl('/proxy', CRM_PROXY_URL), cache: new InMemoryCache(), - link: new HttpLink({ - uri: getServerUrl('/proxy', CRM_PROXY_URL), - }), - defaultOptions: { - query: { - fetchPolicy: 'no-cache', - errorPolicy: 'all', - }, - }, }); diff --git a/src/client/services/CrmService/index.ts b/src/client/services/CrmService/index.ts index 55855d1..ab01bc7 100644 --- a/src/client/services/CrmService/index.ts +++ b/src/client/services/CrmService/index.ts @@ -13,6 +13,7 @@ import { TEntities } from 'core/types/Entities/crmEntityNames'; import { isPlural, singular } from 'pluralize'; import client from './client'; import { convertEntityToOption } from './tools/entity'; +import { cloneDeep } from 'lodash'; export default class { static crmgqlquery = ({ @@ -30,7 +31,9 @@ export default class { if (!res.data || res.errors) { reject(res.error || res.errors); } - let resEntities: TEntities = res.data; + let resEntities: TEntities = cloneDeep( + res.data, + ); Object.keys(resEntities).forEach(targetName => { const targetEnt: TCRMEntity | TCRMEntity[] =