From ec8f863a390f7afa5ff7bc1e5c3ca211934bac27 Mon Sep 17 00:00:00 2001 From: Vaibhav Rathore Date: Mon, 5 Oct 2020 16:39:43 +0530 Subject: [PATCH] language bug fixed at all places --- src/containers/Form/FormLayout.tsx | 12 ++++++++---- src/graphql/mutations/Automation.ts | 4 ++++ src/graphql/mutations/Contact.ts | 8 ++++++++ src/graphql/mutations/Tag.ts | 4 ++++ src/graphql/mutations/Template.ts | 4 ++++ 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/containers/Form/FormLayout.tsx b/src/containers/Form/FormLayout.tsx index 6b010520fe..88aa65d547 100644 --- a/src/containers/Form/FormLayout.tsx +++ b/src/containers/Form/FormLayout.tsx @@ -110,15 +110,19 @@ export const FormLayout: React.SFC = ({ let toastMessage: {} | null | undefined; // get the organization for current user and have languages option set to that. + + const capitalListItemName = listItemName[0].toUpperCase() + listItemName.slice(1); + + const itemId = match.params.id ? match.params.id : false; + const organization = useQuery(USER_LANGUAGES, { onCompleted: (data: any) => { - setLanguageId(data.currentUser.user.organization.defaultLanguage.id); + if (!itemId) { + setLanguageId(data.currentUser.user.organization.defaultLanguage.id); + } }, }); - const capitalListItemName = listItemName[0].toUpperCase() + listItemName.slice(1); - - const itemId = match.params.id ? match.params.id : false; const { loading, error } = useQuery(getItemQuery, { variables: { id: itemId }, skip: !itemId, diff --git a/src/graphql/mutations/Automation.ts b/src/graphql/mutations/Automation.ts index 2035a0ec43..4579856cfe 100644 --- a/src/graphql/mutations/Automation.ts +++ b/src/graphql/mutations/Automation.ts @@ -33,6 +33,10 @@ export const UPDATE_AUTOMATION = gql` flow { id name + language { + id + label + } } errors { key diff --git a/src/graphql/mutations/Contact.ts b/src/graphql/mutations/Contact.ts index a4991cd681..a51bb19b4f 100644 --- a/src/graphql/mutations/Contact.ts +++ b/src/graphql/mutations/Contact.ts @@ -18,6 +18,10 @@ export const CREATE_CONTACT = gql` id name phone + language { + id + label + } } } } @@ -30,6 +34,10 @@ export const UPDATE_CONTACT = gql` id name phone + language { + id + label + } } } } diff --git a/src/graphql/mutations/Tag.ts b/src/graphql/mutations/Tag.ts index c40b54721d..98f717ae89 100644 --- a/src/graphql/mutations/Tag.ts +++ b/src/graphql/mutations/Tag.ts @@ -39,6 +39,10 @@ export const UPDATE_TAG = gql` label description colorCode + language { + id + label + } parent { id } diff --git a/src/graphql/mutations/Template.ts b/src/graphql/mutations/Template.ts index 13b1cfede7..f8b3d7aef2 100644 --- a/src/graphql/mutations/Template.ts +++ b/src/graphql/mutations/Template.ts @@ -34,6 +34,10 @@ export const UPDATE_TEMPLATE = gql` id label body + language { + id + label + } } } }