Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

(fix) white screen issue

Blue Mouse1d0f3c2678e7
diff --git a/src/index.js b/src/index.js
index 5b12b128e..50458f0bf 100644
--- a/src/index.js
+++ b/src/index.js
@@ -8,6 +8,8 @@ import { HelmetProvider } from 'react-helmet-async'
import { transitions, positions, Provider as AlertProvider } from '@blaumaus/react-alert'
import 'billboard.js/dist/billboard.min.css'
import 'prismjs/themes/prism-tomorrow.css'
+import { getAccessToken, removeAccessToken } from 'utils/accessToken'
+import { getRefreshToken } from 'utils/refreshToken'
import CrashHandler from 'pages/CrashHandler'
import { trackViews } from 'utils/analytics'
@@ -31,6 +33,19 @@ if (process.env.NODE_ENV !== 'production') {
localStorage.debug = 'swetrix:*'
}
+// this function is needed to remove old style auth tokens to log out users and force them to log in to use auth / refresh tokens pair
+// otherwise the app crashes (this problem is on production right now, sorry I'm an idiot and didn't test it before)
+const removeObsoleteAuthTokens = () => {
+ const accessToken = getAccessToken()
+ const refreshToken = getRefreshToken()
+
+ if (accessToken && !refreshToken) {
+ removeAccessToken()
+ }
+}
+
+removeObsoleteAuthTokens()
+
const container = document.getElementById('root')
const root = createRoot(container)