diff --git a/client/src/App.jsx b/client/src/App.jsx index 67171e2..7c7fcc7 100644 --- a/client/src/App.jsx +++ b/client/src/App.jsx @@ -19,60 +19,63 @@ function App() { <BrowserRouter> <Navbar /> <div className="pages"> - <Routes> - <Route - path="/" - element={ - user ? <Navigate to="/dashboard/companies" /> : <Homepage /> + <Routes> + <Route + path="/" + element={ + user ? <Navigate to="/dashboard/companies" /> : <Homepage /> + } + /> + <Route + path="/auth/signup" + element={ + user ? <Navigate to="/dashboard/companies" /> : <Signup /> + } + /> + <Route + path="/auth/login" + element={ + user ? <Navigate to="/dashboard/companies" /> : <Login /> + } + /> + <Route + path="/dashboard" + element={ + user ? <Navigate to="/dashboard/companies" replace /> : <Signup /> } - /> - <Route - path="/auth/signup" - element={ - user ? <Navigate to="/dashboard/companies" /> : <Signup /> - } - /> - <Route - path="/auth/login" - element={ - user ? <Navigate to="/dashboard/companies" /> : <Login /> - } - /> - <Route - path="/dashboard" - element={<Navigate to="/dashboard/companies" replace />} - /> - <Route - path="/dashboard/companies" - element={ - user ? <CompanyDashboard /> : <Navigate to="/auth/signup" /> - } - /> - <Route - path="/dashboard/companies/:companyId/stocks" - element={<StocksDashboard />} - /> - <Route - path="/dashboard/companies/:companyId/data" - element={<DataDashboard />} - /> - <Route - path="/dashboard/companies/:companyId/prediction" - element={<PredictionDashboard />} - /> + /> + <Route + path="/dashboard/companies" + element={ + user ? <CompanyDashboard /> : <Navigate to="/auth/signup" /> + } + /> + <Route + path="/dashboard/companies/:companyId/stocks" + element={user ? <StocksDashboard /> : <Navigate to="/auth/login" /> + } + /> + <Route + path="/dashboard/companies/:companyId/data" + element={user ? <DataDashboard /> : <Navigate to="/auth/login" />} + /> + <Route + path="/dashboard/companies/:companyId/prediction" + element={ user ? <PredictionDashboard /> : <Navigate to="/auth/login" />} + /> - <Route - path="/dashboard/companies/:companyId/chat" - element={<ChatDashboard />} - /> - <Route - path="/company/:companyId" - element={ - <Navigate to="/dashboard/companies/:companyId/stocks" replace /> - } - /> - <Route path="*" element={<Navigate to="/" />} /> - </Routes> + <Route + path="/dashboard/companies/:companyId/chat" + element={user ? <ChatDashboard /> : <Navigate to="/auth/login" />} + /> + <Route + path="/company/:companyId" + element={ + user ? <Navigate to="/dashboard/companies/:companyId/stocks" replace /> : <Navigate to="/auth/login" /> + } + /> + <Route path="*" element={<Navigate to="/" />} /> + </Routes> </div> </BrowserRouter> </div>