From 4ae1212a651e70b7c474afd74f082a990a32fdb7 Mon Sep 17 00:00:00 2001 From: Chika Date: Mon, 24 Oct 2022 18:21:05 +0300 Subject: [PATCH] process/agents: fix vscode apollo extension crash --- process/agents/lib/fill-agents-from-lead.ts | 10 +--------- process/agents/lib/query.ts | 11 +++++++++++ process/agents/reactions/common.ts | 10 +--------- 3 files changed, 13 insertions(+), 18 deletions(-) create mode 100644 process/agents/lib/query.ts diff --git a/process/agents/lib/fill-agents-from-lead.ts b/process/agents/lib/fill-agents-from-lead.ts index d9e9a68..a308318 100644 --- a/process/agents/lib/fill-agents-from-lead.ts +++ b/process/agents/lib/fill-agents-from-lead.ts @@ -5,6 +5,7 @@ import type { Elements } from 'Components/Calculation/config/map/values'; import type { GetAgentQuery, GetAgentQueryVariables } from 'graphql/crm.types'; import type RootStore from 'stores/root'; import { normalizeOptions } from 'tools/entity'; +import { QUERY_GET_AGENT } from './query'; function makeFillAgentFromLead( elementName: Elements, @@ -51,15 +52,6 @@ function makeFillAgentFromLead( }; } -const QUERY_GET_AGENT = gql` - query GetAgent($agentid: Uuid!) { - agent: account(accountid: $agentid) { - label: name - value: accountid - } - } -`; - /** * Если lead содержит данные, * то indAgent заполняется ссылкой на карточку Контрагент (account), diff --git a/process/agents/lib/query.ts b/process/agents/lib/query.ts new file mode 100644 index 0000000..3736dfe --- /dev/null +++ b/process/agents/lib/query.ts @@ -0,0 +1,11 @@ +import { gql } from '@apollo/client'; + +/* eslint-disable import/prefer-default-export */ +export const QUERY_GET_AGENT = gql` + query GetAgent($agentid: Uuid!) { + agent: account(accountid: $agentid) { + label: name + value: accountid + } + } +`; diff --git a/process/agents/reactions/common.ts b/process/agents/reactions/common.ts index 9cc8fd5..5fbbc16 100644 --- a/process/agents/reactions/common.ts +++ b/process/agents/reactions/common.ts @@ -8,6 +8,7 @@ import { reaction } from 'mobx'; import type RootStore from 'stores/root'; import { normalizeOptions } from 'tools/entity'; import * as fillAgentsFromLead from '../lib/fill-agents-from-lead'; +import { QUERY_GET_AGENT } from '../lib/query'; dayjs.extend(utc); @@ -84,15 +85,6 @@ export default function commonReactions(store: RootStore, apolloClient: ApolloCl } `; - const QUERY_GET_AGENT = gql` - query GetAgent($agentid: Uuid!) { - agent: account(accountid: $agentid) { - label: name - value: accountid - } - } - `; - reaction( () => $calculation.getElementValue('selectDealerPerson'), async (dealerPersonId) => {