-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am receiving weird error regarding GatePage. #56
Comments
+1 |
I have the same problem. :/ |
I couldn't find a solution so ended up developing my own PrivateRoutes setup. Not perfect but does the job. See below my code if that helps.
|
Thanks. |
you can also just replace the import React, { useEffect } from 'react'
import { compose } from 'redux'
import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
const LOGIN_PATH = '/login'
[...]
const requireSignIn = Component =>
compose(
withRouter,
connect(state => ({ authUser: state.reduxTokenAuth.currentUser })),
)(({ authUser, ...props }) => {
useEffect(() => {
if (!authUser.isSignedIn && !authUser.isLoading) props.history.push(LOGIN_PATH)
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [authUser])
return authUser ? <Component {...props} /> : null
}) |
When using @gtournie solution I found again the race condition of Briefly, the problem is related to The problem can be solved if the context is matched, so upgrading It should be mentioned in the docs. Personally I decide to fork instead of making PR since the author has been inactive |
@suyesh
This config tells redux-token-auth depends on newest react-redux version |
React Router |
Error
Could not find "store" in either the context or props of "Connect(GatedPage)". Either wrap the root component in a <Provider>, or explicitly pass "store" as a prop to "Connect(GatedPage)".
Main index
Routes
Main App container
Versions
The text was updated successfully, but these errors were encountered: