From f8463643fd38ddae47ef45c8dbee8d2573fd951a Mon Sep 17 00:00:00 2001 From: Long Hoang <1732217+loong@users.noreply.github.com> Date: Thu, 4 May 2023 08:43:30 +0800 Subject: [PATCH] Replace useEffect with useProfileQuery --- studio/components/interfaces/Support/SupportForm.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/studio/components/interfaces/Support/SupportForm.tsx b/studio/components/interfaces/Support/SupportForm.tsx index 8a0f044781e..9c482b87bfb 100644 --- a/studio/components/interfaces/Support/SupportForm.tsx +++ b/studio/components/interfaces/Support/SupportForm.tsx @@ -22,6 +22,7 @@ import { useStore, useFlag } from 'hooks' import { post, get } from 'lib/common/fetch' import { detectBrowser } from 'lib/helpers' import { API_URL, PRICING_TIER_PRODUCT_IDS } from 'lib/constants' +import { useProfileQuery } from 'data/profile/profile-query' import Divider from 'components/ui/Divider' import Connecting from 'components/ui/Loading' @@ -76,11 +77,11 @@ const SupportForm: FC = ({ setSentCategory }) => { } }, [uploadedFiles]) - useEffect(() => { - get(`${API_URL}/profile`).then((data) => { - setRespondToEmail(data.primary_email) - }) - }, [respondToEmail]) + useProfileQuery({ + onSuccess(profile) { + setRespondToEmail(profile.primary_email) + }, + }) if (!isInitialized) { return (