From 01f76c77f0cd932fb83c4442da4083baac8876ae Mon Sep 17 00:00:00 2001 From: spiral Date: Thu, 7 Apr 2022 09:21:57 -0400 Subject: [PATCH] feat: toggle Sentry and API url when loading site from localhost --- src/api/index.ts | 2 +- src/main.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/index.ts b/src/api/index.ts index 260bb0b2..7b0ab795 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,7 +1,7 @@ import axios from 'axios'; import * as Sentry from '@sentry/browser'; -const baseUrl = () => localStorage.isBeta ? "https://api.beta.pluralkit.me" : "https://api.pluralkit.me"; +const baseUrl = () => window.location.origin.includes("localhost") ? "http://localhost:5000" : localStorage.isBeta ? "https://api.beta.pluralkit.me" : "https://api.pluralkit.me"; const methods = ['get', 'post', 'delete', 'patch', 'put']; const noop = () => {}; diff --git a/src/main.ts b/src/main.ts index 77475248..e2e5253c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -5,7 +5,7 @@ Sentry.init({ dsn: "https://58109fec589f4c2bbfa190329acf679a@sentry.pluralkit.me/4", integrations: [new Integrations.BrowserTracing()], - enabled: true, + enabled: !window.location.origin.includes("localhost"), debug: false, release: "dev", // Set tracesSampleRate to 1.0 to capture 100%