Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

hoc improvments

kruzhambus8ff5ee683e35
diff --git a/src/hoc/projectProtected.tsx b/src/hoc/projectProtected.tsx
index 38bb42785..297d7e0a9 100644
--- a/src/hoc/projectProtected.tsx
+++ b/src/hoc/projectProtected.tsx
@@ -3,7 +3,7 @@ import { useSelector } from 'react-redux'
import { Redirect, useParams } from 'react-router-dom'
import _find from 'lodash/find'
-
+import _replace from 'lodash/replace'
import { StateType } from 'redux/store'
import routes from 'routes'
@@ -22,8 +22,8 @@ export const withProjectProtected = <P extends PropsType>(WrappedComponent: any)
const project = _find(projects, { id })
- if (project?.isPasswordProtected && !passwords[id]) {
- return <Redirect to={routes.project_protected_password} />
+ if (project?.isPasswordProtected && !project.isOwner && !passwords[id]) {
+ return <Redirect to={_replace(routes.project_protected_password, ':id', id)} />
}
return <WrappedComponent {...props} />