diff options
Diffstat (limited to 'frontend/src/routes/index.tsx')
| -rw-r--r-- | frontend/src/routes/index.tsx | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/frontend/src/routes/index.tsx b/frontend/src/routes/index.tsx index e77421c..b46315b 100644 --- a/frontend/src/routes/index.tsx +++ b/frontend/src/routes/index.tsx @@ -7,25 +7,37 @@ import NewArticle from "../pages/articles/New"; import Register from "../pages/auth/Register"; import Login from "../pages/auth/Login"; -type user = { set: React.Dispatch<React.SetStateAction<string | null>>, value: string | null }; +type user = { + set: React.Dispatch<React.SetStateAction<string | null>>; + value: string | null; +}; +type articleSearch = user; -export default function Index() -{ +export default function Index() { const [user, setUser] = useState<string | null>(null); + const [articleSearch, setArticleSearch] = useState<string | null>(null); const userProp: user = { set: setUser, value: user }; + const articleSearchProp: articleSearch = { + set: setArticleSearch, + value: articleSearch, + }; - return (<> - <Router> - <Routes> - <Route path="/" element = {<Layout />}> - <Route index element={<Home />} /> - <Route path="/article/:id" element={<Article />} /> - <Route path="/article/new" element={<NewArticle />} /> - <Route path="register" element={<Register />} /> - <Route path="login" element={<Login user={userProp}/>} /> - </Route> - </Routes> - </Router> - </>); + return ( + <> + <Router> + <Routes> + <Route + path="/" + element={<Layout user={userProp} articleSearch={articleSearchProp} />}> + <Route index element={<Home articleSearch={articleSearchProp} />} /> + <Route path="/article/:id" element={<Article />} /> + <Route path="/article/new" element={<NewArticle />} /> + <Route path="register" element={<Register />} /> + <Route path="login" element={<Login user={userProp} />} /> + </Route> + </Routes> + </Router> + </> + ); } |
