MSP-3107 update PrivateRoute

This commit is contained in:
veselovnk committed 2024-04-18 11:09:13 +03:00
1 parent d63afbfcd0
commit 5df076b992
1 file changed
-10
-10
View File
@@ -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 />
}