-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #952 from akto-api-security/bugfix/login_page_fix
login page redirect fix
- Loading branch information
Showing
3 changed files
with
27 additions
and
4 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 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
23 changes: 23 additions & 0 deletions
23
apps/dashboard/web/polaris_web/web/src/apps/main/TokenValidator.jsx
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React from 'react' | ||
import { useEffect } from 'react' | ||
import { useNavigate } from 'react-router-dom' | ||
import PersistStore from './PersistStore' | ||
|
||
function TokenValidator() { | ||
|
||
let navigate = useNavigate() | ||
const accessToken = PersistStore(state => state.accessToken) | ||
useEffect(() => { | ||
console.log(accessToken) | ||
if (accessToken === null || accessToken === '') { | ||
navigate('/login') | ||
} else { | ||
navigate('/dashboard/observe/inventory') | ||
} | ||
},[accessToken]) | ||
return ( | ||
<></> | ||
) | ||
} | ||
|
||
export default TokenValidator |