MSP-3107 update PrivateRoute
This commit is contained in:
1 parent
d63afbfcd0
commit
5df076b992
1 file changed
-10
@@ -4,16 +4,10 @@ import { localStorageKeys } from '@constants/localStorageKeys.ts'
|
||||
|
||||
import { LocalStorage } from '@utils/localStorageUtils.ts'
|
||||
|
||||
import useRole from '@hooks/useRole.tsx'
|
||||
|
||||
import { routePaths } from '@routes/routePaths.ts'
|
||||
|
||||
import { PermissionKeys } from '@type/roles.type.ts'
|
||||
|
||||
|
||||
const PrivateRoute = () => {
|
||||
const { hasPermission } = useRole()
|
||||
|
||||
const location = useLocation()
|
||||
const userToken = LocalStorage.get(localStorageKeys.USER_TOKEN)
|
||||
|
||||
@@ -22,10 +16,6 @@ const PrivateRoute = () => {
|
||||
return <Navigate to={routePaths.login} replace />
|
||||
}
|
||||
|
||||
if ( location.pathname !=='/' && !hasPermission(PermissionKeys.read)) {
|
||||
return <Navigate to={routePaths.home} replace />
|
||||
}
|
||||
|
||||
return <Outlet />
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user