From c576460d0a8b0bd89022e01ee856efbf1c4655e4 Mon Sep 17 00:00:00 2001 From: artlu99 Date: Mon, 1 Jul 2024 14:30:13 -0400 Subject: [PATCH] endpoint --- functions/shared/posthog.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/functions/shared/posthog.ts b/functions/shared/posthog.ts index c6eac1f..5da20a3 100644 --- a/functions/shared/posthog.ts +++ b/functions/shared/posthog.ts @@ -1,7 +1,7 @@ import { Env } from '../common'; const sendPosthogEvent = async (env: Env, event: string, distinct_id: string) => { - const url = env.REACT_APP_PUBLIC_POSTHOG_HOST; + const url = env.REACT_APP_PUBLIC_POSTHOG_HOST + '/capture/'; const api_key = env.REACT_APP_PUBLIC_POSTHOG_KEY; const timestamp = new Date().toISOString(); @@ -15,16 +15,13 @@ const sendPosthogEvent = async (env: Env, event: string, distinct_id: string) => }; try { - console.log('posthog attempt', JSON.stringify(payload)); - const response = await fetch(url, { method: 'POST', headers: headers, body: JSON.stringify(payload), }); - const data = await response.json(); - console.log('posthog success', data); + await response.json(); } catch (e) { console.error('posthog error', e); }