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

Move loading mutation call to interceptors #40

Closed
kinow opened this issue Feb 28, 2019 · 4 comments
Closed

Move loading mutation call to interceptors #40

kinow opened this issue Feb 28, 2019 · 4 comments
Milestone

Comments

@kinow
Copy link
Member

kinow commented Feb 28, 2019

It is much easier to have a single place with the setLoading(true) and once complted setLoading(false), rather than having to implement that in each call.

e.g. greyby/vue-spinner#19

@kinow
Copy link
Member Author

kinow commented Feb 28, 2019

No idea if we have something similar for Apollo GraphQL.

@kinow
Copy link
Member Author

kinow commented Mar 4, 2019

There's always a way of intercepting calls to Vuex store (https://vuedose.tips/tips/8/). But I think it wouldn't fit the current design, as the call starts in the service.

@kinow
Copy link
Member Author

kinow commented Mar 5, 2019

Humm, it looks like for ApolloClient, we have to work in the Network Layer, using what they call Middleware and Afterweare: https://www.apollographql.com/docs/react/advanced/network-layer.html#linkMiddleware

@kinow
Copy link
Member Author

kinow commented Mar 5, 2019

Used Vuetify Loader to display the progress. Then set the interceptors for Axios, and instead of searching for a way to intercept requests in GraphQL, replaced their fetch which was using node-fetch by the axios-fetch implementation.

Which means that REST and GraphQL requests share the lower level HTTP client that fetches the data. And we can configure interceptors in a single place 🎉 It deserves a screen cast

gifrecord_2019-03-05_153219

I've added a 3 seconds timeout to the JupyterHub backend service (because it was too fast to see running locally). It's possible to see that the interface used to display progress is the same too between user profile and suites screens.

@kinow kinow closed this as completed Mar 5, 2019
@kinow kinow added this to the 0.1 milestone Sep 10, 2019
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

No branches or pull requests

1 participant