* show cms blog posts in www * remove contentlayer from www * outputFileTracingExcludes * update remotePatterns * fetch cms posts server-side with revalidation * add cms env vars to turbo.json * add www env vars to turbo.json * include cms posts in www sitemap * add migration to remove image from cms post * update cms meta image mapping in www
20 lines
593 B
TypeScript
20 lines
593 B
TypeScript
'use client'
|
|
|
|
import { sendTelemetryEvent } from 'common'
|
|
import type { TelemetryEvent } from 'common/telemetry-constants'
|
|
import { API_URL } from 'lib/constants'
|
|
import { usePathname, useSearchParams } from 'next/navigation'
|
|
|
|
export function useSendTelemetryEvent() {
|
|
const pathname = usePathname()
|
|
const searchParams = useSearchParams()
|
|
|
|
return (event: TelemetryEvent) => {
|
|
const url = new URL(API_URL ?? 'http://localhost:3000')
|
|
url.pathname = pathname ?? ''
|
|
url.search = searchParams?.toString() ?? ''
|
|
|
|
return sendTelemetryEvent(API_URL, event, url.toString())
|
|
}
|
|
}
|