Skip to content

Commit 3f103ab

Browse files
committed
[bugfix]: temporary workaround for auth fix
1 parent ebe06e4 commit 3f103ab

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

frontend/src/App.tsx

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,44 @@
11
import React, { useEffect, useState } from 'react';
22
import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom';
33
import { AnimatePresence } from 'framer-motion';
4+
import { Toaster } from 'react-hot-toast';
45
import Sidebar from './components/layout/Sidebar';
56
import Dashboard from './components/dashboard/Dashboard';
6-
7-
87
import BotIntegrationPage from './components/integration/BotIntegrationPage';
98
import ContributorsPage from './components/contributors/ContributorsPage';
109
import PullRequestsPage from './components/pages/PullRequestsPage';
1110
import SettingsPage from './components/pages/SettingsPage';
1211
import AnalyticsPage from './components/pages/AnalyticsPage';
1312
import SupportPage from './components/pages/SupportPage';
1413
import LandingPage from './components/landing/LandingPage';
14+
import LoginPage from './components/pages/LoginPage';
15+
import ProfilePage from './components/pages/ProfilePage';
1516

1617
function App() {
1718
const [isSidebarOpen, setIsSidebarOpen] = useState(true);
1819
const [activePage, setActivePage] = useState('landing'); // Default to landing page
1920
const [repoData, setRepoData] = useState<any>(null); // Store fetched repo stats
21+
const [isAuthenticated, setIsAuthenticated] = useState(false);
22+
23+
// Check for existing authentication on app load
24+
useEffect(() => {
25+
const savedAuth = localStorage.getItem('isAuthenticated');
26+
if (savedAuth === 'true') {
27+
setIsAuthenticated(true);
28+
}
29+
}, []);
30+
31+
const handleLogin = () => {
32+
setIsAuthenticated(true);
33+
localStorage.setItem('isAuthenticated', 'true');
34+
};
35+
36+
const handleLogout = () => {
37+
setIsAuthenticated(false);
38+
localStorage.removeItem('isAuthenticated');
39+
setActivePage('landing');
40+
setRepoData(null);
41+
};
2042

2143
const renderPage = () => {
2244
switch (activePage) {
@@ -36,15 +58,17 @@ function App() {
3658
return <SupportPage />;
3759
case 'settings':
3860
return <SettingsPage />;
61+
case 'profile':
62+
return <ProfilePage />;
3963
default:
4064
return <Dashboard repoData={repoData} />;
41-
4265
}
4366
};
4467

4568
return (
4669
<Router>
4770
<div className="min-h-screen bg-gray-950 text-white">
71+
<Toaster position="top-right" />
4872
<Routes>
4973
<Route
5074
path="/login"
@@ -89,4 +113,3 @@ function App() {
89113
}
90114

91115
export default App;
92-

0 commit comments

Comments
 (0)