-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from TABA-4th/dev
merge dev branch
- Loading branch information
Showing
14 changed files
with
708 additions
and
297 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,81 @@ | ||
import React from 'react'; | ||
import { BrowserRouter as Router, Routes, Route,Navigate } from 'react-router-dom'; | ||
import { useState } from 'react'; | ||
import Navbar from './components/Navbar'; | ||
import Home from './pages/Home'; | ||
import About from './pages/About'; | ||
import NotFound from './pages/NotFound'; | ||
import WishlistPage from './pages/WishlistPage'; | ||
import Magazine from './pages/Magazine'; | ||
import SignupForm from './pages/Signup'; | ||
import CalendarPage from './pages/CalendarPage'; | ||
import LoginPage from './pages/login'; | ||
import RegisterPage from './pages/register'; | ||
import Register_success from './pages/Register_success'; | ||
import SurveyPage from './pages/Survey'; | ||
import React from "react"; | ||
import { BrowserRouter as Router, Routes, Route } from "react-router-dom"; | ||
import Navbar from "./components/Navbar"; | ||
import Home from "./pages/Home"; | ||
import About from "./pages/About"; | ||
import NotFound from "./pages/NotFound"; | ||
import WishlistPage from "./pages/WishlistPage"; | ||
import Magazine from "./pages/Magazine"; | ||
import CalendarPage from "./pages/CalendarPage"; | ||
import LoginPage from "./pages/login"; | ||
import RegisterPage from "./pages/register"; | ||
import Register_success from "./pages/Register_success"; | ||
import SurveyPage from "./pages/SurveyPage"; | ||
import { AuthProvider } from "./functions/AuthContext"; | ||
import AuthRoute from "./pages/AuthRoute"; | ||
import Empty from "./pages/empty"; | ||
|
||
function App() { | ||
|
||
const [isLoggedIn, setIsLoggedIn] = useState(false); | ||
|
||
// 로그아웃 처리 | ||
const handleLogout = () => { | ||
localStorage.removeItem('accessToken'); | ||
localStorage.removeItem('refreshToken'); | ||
setIsLoggedIn(false); | ||
}; | ||
|
||
|
||
return ( | ||
<div className='wrap'> | ||
<Router> | ||
<Navbar isLoggedIn={isLoggedIn} handleLogout={handleLogout} /> | ||
<div className="main-contents"> | ||
<div className='content'> | ||
<div> | ||
<AuthProvider> | ||
<div className="wrap"> | ||
<Router> | ||
<Navbar /> | ||
<div className="main-contents"> | ||
<div className="content"> | ||
<Routes> | ||
<Route path="/" element={<Home />} /> | ||
<Route path="/about" element={<About />} /> | ||
<Route path="/calender" element={isLoggedIn ? <CalendarPage/> : <Navigate to="/" />} /> | ||
<Route path="/magazine" element={isLoggedIn ? <Magazine/> : <Navigate to="/" />} /> | ||
<Route path="*" element={<NotFound/>} /> | ||
<Route path="/wishlist" element={isLoggedIn ? <WishlistPage/> : <Navigate to="/" />} /> | ||
<Route path="/survey" element={<SurveyPage/>} /> | ||
<Route path="/login" element={<LoginPage setIsLoggedIn={setIsLoggedIn} handleLogout={handleLogout} />} /> | ||
<Route path="/register" element={<RegisterPage/>}/> | ||
<Route path="/register_success" element={<Register_success/>}/> | ||
</Routes> | ||
<Route | ||
path="/calender" | ||
element={ | ||
<AuthRoute> | ||
<CalendarPage /> | ||
</AuthRoute> | ||
} | ||
/> | ||
<Route | ||
path="/magazine" | ||
element={ | ||
<AuthRoute> | ||
<Magazine /> | ||
</AuthRoute> | ||
} | ||
/> | ||
<Route | ||
path="/survey" | ||
element={ | ||
<AuthRoute> | ||
<SurveyPage /> | ||
</AuthRoute> | ||
} | ||
/> | ||
<Route | ||
path="/wishlist" | ||
element={ | ||
<AuthRoute> | ||
<WishlistPage /> | ||
</AuthRoute> | ||
} | ||
/> | ||
|
||
|
||
<Route path="/login" element={<LoginPage />} /> | ||
<Route path="/register" element={<RegisterPage />} /> | ||
<Route | ||
path="/register_success" | ||
element={<Register_success />} | ||
/> | ||
<Route path="/empty" element={ <AuthRoute><Empty/> </AuthRoute>} /> | ||
<Route path="*" element={<NotFound />} /> | ||
</Routes > | ||
|
||
</div> | ||
</div> | ||
</div> | ||
</Router> | ||
</div> | ||
</Router> | ||
</div> | ||
</AuthProvider> | ||
); | ||
} | ||
|
||
export default App; | ||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.