From b558ecbfa15dd0446983700c44b57bb0b3242bcb Mon Sep 17 00:00:00 2001 From: DrMint <29893320+DrMint@users.noreply.github.com> Date: Sat, 13 Jul 2024 14:16:28 +0200 Subject: [PATCH] Mocked analytics when no analytics api url --- src/services.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/services.ts b/src/services.ts index 5345fd6..89870d7 100644 --- a/src/services.ts +++ b/src/services.ts @@ -11,7 +11,14 @@ export const meilisearch = new MeilisearchSDK( import.meta.env.MEILISEARCH_MASTER_KEY ); -export const analytics = new AnalyticsSDK(import.meta.env.ANALYTICS_URL); +const mockedAnalytics = { + trackRequest: () => {}, + trackEvent: () => {}, +}; + +export const analytics = import.meta.env.ANALYTICS_URL + ? new AnalyticsSDK(import.meta.env.ANALYTICS_URL) + : mockedAnalytics; const tokenCache = new TokenCache();