50 lines
2.3 KiB
Diff
Executable File
50 lines
2.3 KiB
Diff
Executable File
diff --git a/src/App.js b/src/App.js
|
|
index 6fdd96c..9728bc2 100644
|
|
--- a/src/App.js
|
|
+++ b/src/App.js
|
|
@@ -1,8 +1,7 @@
|
|
-import React, { useState } from 'react';
|
|
+import React from 'react';
|
|
import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom';
|
|
|
|
-import { isAuthenticated, isApiKeyEnabled } from 'utilities/authUtilities';
|
|
-import { AuthWrapper } from 'utilities/AuthWrapper';
|
|
+import { isApiKeyEnabled } from 'utilities/authUtilities';
|
|
|
|
import HomePage from './pages/HomePage';
|
|
import LoginPage from './pages/LoginPage';
|
|
@@ -14,25 +13,18 @@ import UserManagementPage from 'pages/UserManagementPage';
|
|
import './App.css';
|
|
|
|
function App() {
|
|
- const [isLoggedIn, setIsLoggedIn] = useState(isAuthenticated());
|
|
-
|
|
return (
|
|
<div className="App" data-testid="app-container">
|
|
<Router>
|
|
<Routes>
|
|
- <Route element={<AuthWrapper isLoggedIn={isLoggedIn} hasHeader redirect="/login" />}>
|
|
- <Route path="/" element={<Navigate to="/home" />} />
|
|
- <Route path="/home" element={<HomePage />} />
|
|
- <Route path="/explore" element={<ExplorePage />} />
|
|
- <Route path="/image/:name" element={<RepoPage />} />
|
|
- <Route path="/image/:reponame/tag/:tag" element={<TagPage />} />
|
|
- {isApiKeyEnabled() && <Route path="/user/apikey" element={<UserManagementPage />} />}
|
|
- <Route path="*" element={<Navigate to="/home" />} />
|
|
- </Route>
|
|
- <Route element={<AuthWrapper isLoggedIn={!isLoggedIn} redirect="/" />}>
|
|
- <Route path="/login" element={<LoginPage isLoggedIn={isLoggedIn} setIsLoggedIn={setIsLoggedIn} />} />
|
|
- <Route path="*" element={<Navigate to="/login" />} />
|
|
- </Route>
|
|
+ <Route path="/" element={<Navigate to="/home" />} />
|
|
+ <Route path="/home" element={<HomePage />} />
|
|
+ <Route path="/login" element={<LoginPage />} />
|
|
+ <Route path="/explore" element={<ExplorePage />} />
|
|
+ <Route path="/image/:name" element={<RepoPage />} />
|
|
+ <Route path="/image/:reponame/tag/:tag" element={<TagPage />} />
|
|
+ {isApiKeyEnabled() && <Route path="/user/apikey" element={<UserManagementPage />} />}
|
|
+ <Route path="*" element={<Navigate to="/home" />} />
|
|
</Routes>
|
|
</Router>
|
|
</div>
|