Skip to content
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

Logging function #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Logging function #16

wants to merge 2 commits into from

Conversation

s-coimbra21
Copy link
Contributor

Added a function that is called whenever an error occurs in a mutation or query. Whether it is a connection error or GraphQL error. It can be added like so:

@rootDataConnect({
  logging: ({data, errors}, dispatch) =>  console.log(`${errors}`)
})

data may not exist, it will be there if one of the queries returned some data but had GraphQL errors.
errors should always an array of objects which should always have a message key with a string.

@bruno12mota
Copy link
Member

Fix the unit tests and it's ready to go ;)

@s-coimbra21
Copy link
Contributor Author

Changed so that the logging function isn't kept in redux state (for obvious performance reasons). It must now be passed in the logging key of the rootDataConnect config for queries and in the mutation's options ({ fragments: {...}, logging: console.log}) for mutations.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 71.774% when pulling f49bc19 on s-coimbra21:loggingAPI into ea045ff on relax:master.

@bruno12mota
Copy link
Member

Hey! Could you fix the conflicts so we can merge this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants