diff --git a/src/routes/+layout.ts b/src/routes/+layout.ts index e4cc1f6..e964ddd 100644 --- a/src/routes/+layout.ts +++ b/src/routes/+layout.ts @@ -1,58 +1,24 @@ -import { Toucan } from "toucan-js"; import * as Sentry from '@sentry/browser'; import { BrowserTracing } from "@sentry/tracing"; /** @type {import('./$types').PageLoad} */ export function load({ url, event }) { - let sentry; // @ts-ignore - if(import.meta.env.VITE_SENTRY_DSN && typeof event !== "undefined") if(typeof window === 'undefined') { - sentry = new Toucan({ + if(import.meta.env.VITE_SENTRY_DSN && typeof event !== "undefined" && typeof window !== 'undefined') + Sentry.init({ // @ts-ignore - dsn: import.meta.env.VITE_SENTRY_DSN, - + dsn: import.meta.env.VITE_SENTRY_DSN, // @ts-ignore environment: import.meta.env.VITE_SENTRY_ENVIRONMENT, // @ts-ignore release: import.meta.env.VITE_SENTRY_RELEASE, - request: event.request, - requestDataOptions: { - allowedHeaders: [ - 'user-agent', - 'cf-challenge', - 'accept-encoding', - 'accept-language', - 'cf-ray', - 'content-length', - 'content-type', - 'x-real-ip', - 'host', - 'cf-ipcountry' - ], - allowedSearchParams: /(.*)/ - } + integrations: [ + new BrowserTracing(), + ], + tracesSampleRate: 1 }); - } else { - sentry = Sentry; - if(!sentry.isInitalized) { - Sentry.init({ - // @ts-ignore - dsn: import.meta.env.VITE_SENTRY_DSN, - // @ts-ignore - environment: import.meta.env.VITE_SENTRY_ENVIRONMENT, - // @ts-ignore - release: import.meta.env.VITE_SENTRY_RELEASE, - integrations: [ - new BrowserTracing(), - ], - tracesSampleRate: 1 - }); - - sentry.isInitalized = true; - } } return { - url: url.pathname, - sentry + url: url.pathname }; } \ No newline at end of file