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!

update work with token

Maksim Mrug885ba22ad66d
diff --git a/app/root.tsx b/app/root.tsx
index 8a9e41703..c4974130e 100644
--- a/app/root.tsx
+++ b/app/root.tsx
@@ -12,6 +12,8 @@ import { Provider } from 'react-redux'
import { transitions, positions, Provider as AlertProvider } from '@blaumaus/react-alert'
import AlertTemplate from 'ui/Alert'
import { trackViews } from 'utils/analytics'
+import { getAccessToken, removeAccessToken } from 'utils/accessToken'
+import { getRefreshToken } from 'utils/refreshToken'
import AppWrapper from 'App'
@@ -36,6 +38,17 @@ export const links: LinksFunction = () => [
{ rel: 'stylesheet', href: tailwindCss },
]
+const removeObsoleteAuthTokens = () => {
+ const accessToken = getAccessToken()
+ const refreshToken = getRefreshToken()
+
+ if (accessToken && !refreshToken) {
+ removeAccessToken()
+ }
+}
+
+removeObsoleteAuthTokens()
+
export default function App() {
return (
<html lang='en'>
@@ -47,10 +60,12 @@ export default function App() {
</head>
<body>
<Provider store={store}>
- <AppWrapper />
- <ScrollRestoration />
- <Scripts />
- {process.env.NODE_ENV === 'development' && <LiveReload />}
+ <AlertProvider template={AlertTemplate} {...options}>
+ <AppWrapper />
+ <ScrollRestoration />
+ <Scripts />
+ {process.env.NODE_ENV === 'development' && <LiveReload />}
+ </AlertProvider>
</Provider>
</body>
</html>