From e83ddb92aee25b55b7f817661df40e41c19e33a8 Mon Sep 17 00:00:00 2001 From: phamhieu Date: Mon, 15 May 2023 11:15:21 +0700 Subject: [PATCH] fix: create profile --- studio/data/profile/profile-query.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/studio/data/profile/profile-query.ts b/studio/data/profile/profile-query.ts index 63d16a441d7..bd06b0965a9 100644 --- a/studio/data/profile/profile-query.ts +++ b/studio/data/profile/profile-query.ts @@ -4,6 +4,8 @@ import { API_URL } from 'lib/constants' import { useCallback } from 'react' import { profileKeys } from './keys' import Telemetry from 'lib/telemetry' +import { useRouter } from 'next/router' +import { useTelemetryProps } from 'common' export type Profile = { id: number @@ -25,18 +27,19 @@ export type ProfileResponse = Profile * This will also need to send a sign_up event */ async function createProfile() { + const router = useRouter() + const telemetryProps = useTelemetryProps() + const response = await post(`${API_URL}/profile`, {}) if (response.error) { throw response.error } + // send conversion event Telemetry.sendEvent( { category: 'conversion', action: 'sign_up', label: '' }, - { - screenResolution: - typeof window !== 'undefined' ? `${window.innerWidth}x${window.innerHeight}` : undefined, - language: 'en-US', - } + telemetryProps, + router ) return response