From 607e7f44e92e3b22055e7dbe498b9c10f582d88b Mon Sep 17 00:00:00 2001 From: CrispyBaguette Date: Sun, 8 Oct 2023 11:25:41 +0200 Subject: [PATCH] handle missing umami --- client/src/App.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/client/src/App.tsx b/client/src/App.tsx index 7fab080..507e5d2 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -26,11 +26,16 @@ function App() { const ditheredImage = await new Ditherer().dither(imageArray, palette); setDitheredImage(new Blob([ditheredImage], { type: "image/png" })); setAppState(AppState.IMAGE_PROCESSED); - (window as any).umami.track("image processed"); + + if ("umami" in window) { + (window as any).umami.track("image processed"); + } } catch (e) { console.error(e); window.alert("Something went wrong. Please try again."); - (window as any).umami.track("processing error"); + if ("umami" in window) { + (window as any).umami.track("processing error"); + } } };