Vuex Apollo (Bringing the best of both worlds together)
First stable release is out
Install
npm install vuex-apollo --save
Import
- vuexApollo can be imported as a normal vue plugin
- You can pass the plugin 2 options
- The uri of the graphql server
- An Array of objects with the module name (name) and the raw module (module)
Vue el: '#app'
Usage
- Along with the export for vuexApollo you can also get some of the Vuex map functions from this package
- So you can do the following within your application when bootstrapped with vuexApollo
Testing Vuex Apollo Name: {{ name }} Email: {{ email }} Get New User
Building a Module
- Modules are built in a standard fashion to how you would nomally scaffold a module
- The Action is now passed two new properties in the context
- apollo (This is an instance of Apollo Client)
- gql (This )
- You can also init a module from actions by declaring an INIT action
You Can See An Example Module Here
This is an Example of actions using the INIT self called action and destructing the apollo and gql properties
const actions = { console } { apollo }
Features
- Vuex
- Apollo (GraphQL)
- Seamless Integration
ToDo
- Add Error Logging through an error link
- Look at making the bundle smaller
- Add Unit Testing
- Add E2E Testing
- Integrate Vuex with apollo-link-state
- When major Vuex changes affect this plugin adapt the plugin - Vue Roadmap
Feedback
- Please raise any issues you find
- This is still a work in progress and I'll update as and when I have free time
If I've helped you out in any way why not: :blush: