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
Simplify Apollo Auth Example #3350
Comments
@ads1018 I didn't quite understand what you meant by simplify it? If you could explain some more what you're thinking, I would be happy to try put something together :) |
@DevSpeak awesome! Yeah I think we can assign the graphql query and config object to two separate variables. For example:
We can export these vars inside a separate file like you suggested or put them at the top of this one. Perhaps we rename I like the idea of using async/await :) Also, we still need to update this example to apollo-client 2.0! |
@ads1018 This is what I got so far, https://github.com/DevSpeak/next.js/tree/canary/examples/with-apollo-auth |
Ah my bad, I was looking at the master branch. Sweet. Great stuff! The only downside of putting the mutations in a separate file is that it's not immediately clear what the mutation prop does, but I think you make it easier on the reader by adding an inline comment to make note of where it's coming from. The page is much more succinct and easier to scan, and I like that all the logic related to auth can be found in a single file. 👍 |
This part of the apollo auth example (the
createUser
&signinUser
logic) feels a bit long winded.https://github.com/zeit/next.js/blob/a8c344fa19ae242f90277391340463c5050b107e/examples/with-apollo-auth/pages/create-account.js#L46
Is it possible to simplify? Perhaps we can break this part up into another function or maybe even move it into it's own file. Thoughts?
The text was updated successfully, but these errors were encountered: