Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
inventory-promotion-react
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ascend
inventory-promotion-react
Commits
d996804a
Commit
d996804a
authored
May 13, 2021
by
Ben Anderson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed broken auth
parent
77ecc740
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2242 additions
and
1675 deletions
+2242
-1675
package-lock.json
package-lock.json
+2234
-1667
AuthRoute.jsx
src/component/AuthRoute.jsx
+8
-8
No files found.
package-lock.json
View file @
d996804a
This diff is collapsed.
Click to expand it.
src/component/AuthRoute.jsx
View file @
d996804a
import
{
useEffect
,
useContext
}
from
"react"
;
import
{
useEffect
,
useContext
}
from
"react"
;
import
React
from
"react"
;
import
React
from
"react"
;
import
{
Redirect
,
Route
}
from
"react-router"
;
import
{
Redirect
,
Route
}
from
"react-router"
;
import
{
AuthContext
}
from
'../App'
;
import
{
AuthContext
}
from
"../App"
;
export
default
function
AuthRoute
({
children
,
...
rest
})
{
const
{
isLoggedIn
}
=
useContext
(
AuthContext
)
export
default
function
AuthRoute
({
children
,
...
rest
})
{
const
{
isLoggedIn
}
=
useContext
(
AuthContext
);
return
(
return
(
<
Route
<
Route
...
@@ -14,12 +12,14 @@ export default function AuthRoute({children, ...rest}) {
...
@@ -14,12 +12,14 @@ export default function AuthRoute({children, ...rest}) {
render=
{
({
location
})
=>
{
render=
{
({
location
})
=>
{
if
(
isLoggedIn
)
{
if
(
isLoggedIn
)
{
if
(
location
.
pathname
===
"/login"
)
{
if
(
location
.
pathname
===
"/login"
)
{
return
<
Redirect
to=
"/"
/>;
// return <Redirect to="/" />;
return
children
;
}
else
{
}
else
{
return
children
;
return
children
;
}
}
}
else
if
(
location
.
pathname
!==
"/login"
)
{
}
else
if
(
location
.
pathname
!==
"/login"
)
{
return
<
Redirect
to=
"/login"
/>;
// return <Redirect to="/login" />;
return
children
;
}
}
return
children
;
return
children
;
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment