The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat: add X-GA-Client-Id to request header
phamhieu96438fe79515
diff --git a/studio/components/ui/PageTelemetry.tsx b/studio/components/ui/PageTelemetry.tsxindex 1754214bd8a..586219db730 100644--- a/studio/components/ui/PageTelemetry.tsx+++ b/studio/components/ui/PageTelemetry.tsx@@ -1,7 +1,6 @@import { useStore } from 'hooks'import { post } from 'lib/common/fetch'import { API_URL, IS_PLATFORM } from 'lib/constants'-import { getScreenResolution } from 'lib/telemetry'import { observer } from 'mobx-react-lite'import { useRouter } from 'next/router'import { FC, useEffect } from 'react'diff --git a/studio/lib/common/fetch/base.ts b/studio/lib/common/fetch/base.tsindex bc6b87c49f4..45597dc3588 100644--- a/studio/lib/common/fetch/base.ts+++ b/studio/lib/common/fetch/base.ts@@ -108,5 +108,10 @@ export async function constructHeaders(requestId: string, optionHeaders?: { [proif (accessToken) headers.Authorization = `Bearer ${accessToken}`}+ if (typeof window !== 'undefined') {+ const gaClientId = window?.localStorage?.getItem('ga_client_id')+ if (gaClientId && gaClientId !== 'undefined') headers['X-GA-Client-Id'] = gaClientId+ }+return headers}diff --git a/studio/stores/UiStore.ts b/studio/stores/UiStore.tsindex 5872763c42f..ac8ffd49acc 100644--- a/studio/stores/UiStore.ts+++ b/studio/stores/UiStore.ts@@ -175,5 +175,12 @@ export default class UiStore implements IUiStore {setGaClientId(clientId?: string) {this.gaClientId = clientId++ /**+ * We need to access ga client_id from base.constructHeaders method or from supabase.com+ * in order to set custom header('ga_client_id).+ * TODO: Do we have a better way than storing the value in local storage?+ */+ window.localStorage.setItem('ga_client_id', String(clientId))}}