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
Pass query string param of login type on nav button clicks to load login form on right setting #55
Comments
Hi @joelwass, I can help on this one. |
Hi,
|
Use this https://github.com/zeit/next.js/blob/master/errors/url-deprecated.md what that means is in the signinregister.js page you'll wrap the page export in then you should access the type in the loginForm just with this.props.type and check if it's equal to 'teacher' |
It might be better to use the built-in It would look something like this: const SignInSignUp = (props) => {
// markup
// props.teacher is true if teacher query was passed
}
SignInSignUp.getInitialProps = async ({ query }) => {
console.log(query) // { type: 'teacher' }
return { teacher: query.type === 'teacher' }
} |
@SahibArora Definitely go with @stripedpajamas suggestion to avoid use of a HOC when not necessary after adding the getInitialProps method that @stripedpajamas outlined, you can pass in the type prop to loginForm like i mentioned with |
Thank you for your help @joelwass and @stripedpajamas. I will continue further on it. |
Hello again, Just one thing,
This is how I passed the parameters through Link -
Do you have any suggestions on this one, that why am I receiving the undefined. |
I think you can just pass it into the Link component as follows:
|
@SahibArora Your
|
also if you could pass in |
I did the |
It worked, perfect! |
Toggle button enhancement for [issue #55] done!
Currently, if I click "I'm a teacher" within the nav, the login form loads but with the default setting of "i'm a donor" selected in the toggle above the sign in form.
let's pass a query string param
?type=teacher
with the navigation with "I'm a teacher" is selected, and then grab it off the query string param in the login page and pass it in as a prop to the loginForm component.The text was updated successfully, but these errors were encountered: