From 89937904109b8dec9003f4a20702da62611b1394 Mon Sep 17 00:00:00 2001 From: Enzo Mercanti <131273915+enzomerca@users.noreply.github.com> Date: Thu, 5 Sep 2024 11:48:05 -0300 Subject: [PATCH] fix: change query used to enable quote link on my account page (#62) --- CHANGELOG.md | 3 +++ react/B2BQuotesLink.tsx | 2 +- react/graphql/checkPermissions.graphql | 11 +---------- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df4a1ad..aab354b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed +- Use getQuotesEnabledForUser instead of getUserByEmail to define "My Quotes" button visibility + ## [1.6.3] - 2024-09-04 ### Fixed diff --git a/react/B2BQuotesLink.tsx b/react/B2BQuotesLink.tsx index 749e4cd..b488fde 100644 --- a/react/B2BQuotesLink.tsx +++ b/react/B2BQuotesLink.tsx @@ -28,7 +28,7 @@ const B2BQuotesLink: FunctionComponent = ({ render }) => { return } - if (data.getUserByEmail[0]?.id) { + if (data.getQuoteEnabledForUser) { setShow(true) } }, [data, userEmail, sessionResponse]) diff --git a/react/graphql/checkPermissions.graphql b/react/graphql/checkPermissions.graphql index d5060de..eb49d40 100644 --- a/react/graphql/checkPermissions.graphql +++ b/react/graphql/checkPermissions.graphql @@ -1,12 +1,3 @@ query CheckPermissions($email: String!) { - getUserByEmail(email: $email) - @context(provider: "vtex.storefront-permissions") { - id - roleId - userId - clId - orgId - costId - canImpersonate - } + getQuoteEnabledForUser(email: $email) }