Hands-On Full-Stack Web Development with GraphQL and React by Sebastian Grebe

Hands-On Full-Stack Web Development with GraphQL and React by Sebastian Grebe

Author:Sebastian Grebe
Language: eng
Format: epub
Tags: COM051260 - COMPUTERS / Programming Languages / JavaScript, COM060180 - COMPUTERS / Web / Web Services and APIs, COM060160 - COMPUTERS / Web / Web Programming
Publisher: Packt Publishing
Published: 2019-01-31T21:10:20+00:00


Then, inside the LoginRegisterForm class, we replace the render method with the following code:

render() {

const { changeLoginState } = this.props;

return (

<div className="authModal">

<LoginMutation changeLoginState={changeLoginState}><LoginForm/></LoginMutation>

</div>

)

}

Edit the LoginMutation component and extract the new function from the properties:

const { children, changeLoginState } = this.props;

We can then execute the changeLoginState function within the update method:

if(login.token) {

localStorage.setItem('jwt', login.token);

changeLoginState(true);

}

When logging in, our application presents us with the common posts feed as before. The authentication flow is now working, but there is one more open task. In the next step, we allow new users to register at Graphbook.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.