-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
14 additions
and
15 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
This file was deleted.
Oops, something went wrong.
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
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
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,29 +1,29 @@ | ||
import {FC, memo} from 'react'; | ||
import {Navigate, Route, Routes} from 'react-router-dom'; | ||
import {Navigate, Route, Routes as ReactRoutes} from 'react-router-dom'; | ||
|
||
import {ROUTE__LOGIN, ROUTE__MAIN} from 'src/constants/routes'; | ||
import useAuth from 'src/hooks/useAuth'; | ||
import Login from 'src/pages/Login'; | ||
import Main from 'src/pages/Main'; | ||
|
||
const AppRoutes: FC = () => { | ||
const Routes: FC = () => { | ||
const {isAuthenticated} = useAuth(); | ||
|
||
if (!isAuthenticated) { | ||
return ( | ||
<Routes> | ||
<ReactRoutes> | ||
<Route path={ROUTE__LOGIN} element={<Login />} /> | ||
<Route path="*" element={<Navigate to={ROUTE__LOGIN} replace />} /> | ||
</Routes> | ||
</ReactRoutes> | ||
); | ||
} | ||
|
||
return ( | ||
<Routes> | ||
<ReactRoutes> | ||
<Route path={ROUTE__MAIN} element={<Main />} /> | ||
<Route path="*" element={<Navigate to={ROUTE__MAIN} replace />} /> | ||
</Routes> | ||
</ReactRoutes> | ||
); | ||
}; | ||
|
||
export default memo(AppRoutes); | ||
export default memo(Routes); |
File renamed without changes.