From b63a402c4f96bd23e4ca91247333c2b4933fc566 Mon Sep 17 00:00:00 2001 From: mdshamoon Date: Thu, 30 Jun 2022 16:07:22 +0530 Subject: [PATCH] added null check for organization services --- src/components/floweditor/FlowEditor.tsx | 30 +++++++++++++----------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/components/floweditor/FlowEditor.tsx b/src/components/floweditor/FlowEditor.tsx index 510043ab3..49d566c3d 100644 --- a/src/components/floweditor/FlowEditor.tsx +++ b/src/components/floweditor/FlowEditor.tsx @@ -59,22 +59,24 @@ export const FlowEditor = (props: FlowEditorProps) => { const [getOrganizationServices] = useLazyQuery(GET_ORGANIZATION_SERVICES, { fetchPolicy: 'network-only', - onCompleted: (services) => { - const { dialogflow, googleCloudStorage, flowUuidDisplay, contactProfileEnabled } = - services.organizationServices; + onCompleted: ({ organizationServices }) => { + if (organizationServices) { + const { dialogflow, googleCloudStorage, flowUuidDisplay, contactProfileEnabled } = + organizationServices; - if (googleCloudStorage) { - config.attachmentsEnabled = true; - } - if (!dialogflow) { - config.excludeTypes.push('split_by_intent'); - } - if (flowUuidDisplay) { - config.showNodeLabel = true; - } + if (googleCloudStorage) { + config.attachmentsEnabled = true; + } + if (!dialogflow) { + config.excludeTypes.push('split_by_intent'); + } + if (flowUuidDisplay) { + config.showNodeLabel = true; + } - if (contactProfileEnabled) { - config.filters.push('profile'); + if (contactProfileEnabled) { + config.filters.push('profile'); + } } showFlowEditor(document.getElementById('flow'), config);