Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Replace useEffect with useProfileQuery

Long Hoangf8463643fd38
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<Props> = ({ setSentCategory }) => {
}
}, [uploadedFiles])
- useEffect(() => {
- get(`${API_URL}/profile`).then((data) => {
- setRespondToEmail(data.primary_email)
- })
- }, [respondToEmail])
+ useProfileQuery({
+ onSuccess(profile) {
+ setRespondToEmail(profile.primary_email)
+ },
+ })
if (!isInitialized) {
return (