Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-capstone-design1
/
Triz_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
sdy
2020-05-08 12:06:57 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8493d060f65ef8715f72bb06a92c40a3237e344f
8493d060
1 parent
5c0b3bd2
create Router.js
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
front/src/Routes/Router.js
front/src/Routes/Router.js
0 → 100644
View file @
8493d06
import
React
from
"react"
;
import
PropTypes
from
"prop-types"
;
import
{
BrowserRouter
as
Router
,
Route
,
Switch
}
from
"react-router-dom"
;
import
Auth
from
"./Auth"
;
import
Home
from
"./Home"
;
const
LoggedInRoutes
=
()
=>
(
<>
<
Route
exact
path
=
"/"
component
=
{
Home
}
/
>
<
/
>
);
const
LoggedOutRoutes
=
()
=>
(
<>
<
Route
exact
path
=
"/"
component
=
{
Auth
}
/
>
<
/
>
);
const
AppRouter
=
({
isLoggedIn
})
=>
(
<
Router
>
<
Switch
>
{
isLoggedIn
?
<
LoggedInRoutes
/>
:
<
LoggedOutRoutes
/>
}
<
/Switch
>
<
/Router
>
);
AppRouter
.
propTypes
=
{
isLoggedIn
:
PropTypes
.
bool
.
isRequired
,
};
export
default
AppRouter
;
Please
register
or
login
to post a comment