mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 01:45:10 +03:00
chore: update API_URL preview check
This commit is contained in:
1 parent
da33e3bea6
commit
5e2dca6cc0
4 files changed
+8
-8
No files matched your search
@@ -1,5 +1,4 @@
|
||||
import { Button, IconBookOpen } from 'ui'
|
||||
import Link from 'next/link'
|
||||
import { useRouter } from 'next/router'
|
||||
import SectionContainer from './Layouts/SectionContainer'
|
||||
import Telemetry, { GoogleAnalyticsEvent } from '~/lib/telemetry'
|
||||
@@ -10,8 +9,8 @@ const Hero = () => {
|
||||
const router = useRouter()
|
||||
const googleAnalyticsProps = useGoogleAnalyticsProps()
|
||||
|
||||
const trackAndNavigate = (url: string, event: GoogleAnalyticsEvent) => {
|
||||
Telemetry.sendEvent(event, googleAnalyticsProps)
|
||||
const trackAndNavigate = async (url: string, event: GoogleAnalyticsEvent) => {
|
||||
await Telemetry.sendEvent(event, googleAnalyticsProps)
|
||||
router.push(url)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
export const APP_NAME = 'Supabase'
|
||||
export const DESCRIPTION = 'The Open Source Alternative to Firebase.'
|
||||
export const IS_PROD = process.env.NEXT_PUBLIC_VERCEL_ENV === 'production'
|
||||
export const API_URL = IS_PROD ? process.env.NEXT_PUBLIC_API_URL : '/api'
|
||||
export const IS_PREVIEW = process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview'
|
||||
export const API_URL = process.env.NEXT_PUBLIC_API_URL
|
||||
|
||||
// Launch Weeek
|
||||
export const SAMPLE_TICKET_NUMBER = 1234
|
||||
|
||||
@@ -8,12 +8,12 @@ const GoogleAnalyticsEvents: GoogleAnalyticsEventType = {
|
||||
www_hp_hero_startProject: {
|
||||
action: 'www_hp_hero_startProject',
|
||||
category: 'link',
|
||||
label: 'Clicks on “Start your project” button in the home page hero',
|
||||
label: '',
|
||||
},
|
||||
www_hp_hero_documentation: {
|
||||
action: 'www_hp_hero_documentation',
|
||||
category: 'link',
|
||||
label: 'Clicks on “Documentation” button in the home page hero',
|
||||
label: '',
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { post } from '~/lib/fetchWrapper'
|
||||
import { API_URL, IS_PROD } from 'lib/constants'
|
||||
import { API_URL, IS_PROD, IS_PREVIEW } from 'lib/constants'
|
||||
|
||||
export interface GoogleAnalyticsEvent {
|
||||
category: string
|
||||
@@ -17,7 +17,7 @@ export interface GoogleAnalyticsProps {
|
||||
// but uses different ENV variables for www
|
||||
|
||||
const sendEvent = (event: GoogleAnalyticsEvent, gaProps: GoogleAnalyticsProps) => {
|
||||
if (!IS_PROD) return
|
||||
if (!IS_PROD && !IS_PREVIEW) return
|
||||
|
||||
const { category, action, label, value } = event
|
||||
|
||||
|
||||
Reference in new issue
Block a user