From the GraphCool Tutorial: *User Authentication ...
# prisma-whats-new
u
From the GraphCool Tutorial: User Authentication with Auth0 for React and Apollo Note reads:
Copy code
We redirect to /login to give the user the possibility to add additional required information. If your User type has no additional required fields, **you can simply call the user query to check if there is already a user with the auth0IdToken generated by Auth0 as detailed above. If there is no such user, you can immediately run the createUser mutation instead of redirecting to /login.** If there already is such a user, you can redirect the user to / instead.
My Question: Is it recommending to call (or read) the
User Query
within component did mount? Is this possible? Thanks
Copy code
// in src/components/LoginAuth0.js
componentDidMount() {
  this._lock.on('authenticated', (authResult) => {
    window.localStorage.setItem('auth0IdToken', authResult.idToken)
    this.props.router.replace(`/login`)
  })
}