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-22 14:45:54 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f7f4069d4c87ed75f395a20dbcf0c38c0f51d64c
f7f4069d
1 parent
9594c3ad
update routes
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
15 deletions
front/src/Routes/Router.js
front/src/Routes/Router.js
View file @
f7f4069
import
React
from
"react"
;
import
PropTypes
from
"prop-types"
;
import
{
BrowserRouter
as
Router
,
Route
,
Switch
}
from
"react-router-dom"
;
import
{
Route
,
Switch
,
Redirect
}
from
"react-router-dom"
;
import
Auth
from
"./Auth/AuthContainer"
;
import
RoomList
from
"./Room/RoomContainer"
;
import
Home
from
"../Components/Home"
;
import
OTOChat
from
"./OTOChat/OTOChatContainer"
;
const
LoggedInRoutes
=
()
=>
(
<>
<
Switch
>
<
Route
exact
path
=
"/"
component
=
{
RoomList
}
/
>
<
Route
path
=
"/:roomname"
component
=
{
Home
}
/
>
<
Route
path
=
"/OTOChat"
component
=
{
OTOChat
}
/
>
<
Route
path
=
"/RandomChat"
component
=
{
Home
}
/
>
<
Route
path
=
"/CategoryChat"
component
=
{
Home
}
/
>
<
Route
path
=
"/Profile"
component
=
{
Home
}
/
>
<
/
>
<
Redirect
from
=
"*"
to
=
"/"
/>
<
/Switch
>
);
const
LoggedOutRoutes
=
()
=>
(
<>
<
Switch
>
<
Route
exact
path
=
"/"
component
=
{
Auth
}
/
>
<
/
>
<
Redirect
from
=
"*"
to
=
"/"
/>
<
/Switch
>
);
const
AppRouter
=
({
isLoggedIn
})
=>
(
<
Router
>
<
Switch
>
{
isLoggedIn
?
<
LoggedInRoutes
/>
:
<
LoggedOutRoutes
/>
}
<
/Switch
>
<
/Router
>
);
const
AppRouter
=
({
isLoggedIn
})
=>
isLoggedIn
?
<
LoggedInRoutes
/>
:
<
LoggedOutRoutes
/>
;
AppRouter
.
propTypes
=
{
isLoggedIn
:
PropTypes
.
bool
.
isRequired
,
...
...
Please
register
or
login
to post a comment