-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.tsx
More file actions
25 lines (23 loc) · 797 Bytes
/
Copy pathmain.tsx
File metadata and controls
25 lines (23 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import { ThemeProvider } from './context/ThemeContext';
import App from './App.tsx';
import './index.css';
// Early token extraction - capture OAuth callback token before React mounts
// This ensures the token is saved to localStorage before any auth effects run
if (window.location.pathname === '/auth/callback') {
const params = new URLSearchParams(window.location.search);
const token = params.get('token');
if (token) {
localStorage.setItem('auth_token', token);
// Clean up URL and redirect to home
window.history.replaceState({}, '', '/');
}
}
createRoot(document.getElementById('root')!).render(
<StrictMode>
<ThemeProvider>
<App />
</ThemeProvider>
</StrictMode>
);