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!

fix buuuug with π’’˜~ history push

kruzhambusd1caed5e6c3a
diff --git a/src/hoc/protected.js b/src/hoc/protected.js
index 9366b4fcd..195f63bf3 100644
--- a/src/hoc/protected.js
+++ b/src/hoc/protected.js
@@ -1,5 +1,5 @@
import { useSelector } from 'react-redux'
-import { useHistory } from 'react-router-dom'
+import { Redirect } from 'react-router-dom'
import routes from 'routes'
export const auth = {
@@ -16,10 +16,9 @@ export const auth = {
export const withAuthentication = (WrappedComponent, authParam) => {
const WithAuthentication = (params) => {
const selector = useSelector(authParam.selector)
- const history = useHistory()
if (!selector) {
- history.push(authParam.redirectPath)
+ return <Redirect to={authParam.redirectPath} />
}
return <WrappedComponent {...params} />