ctw*_*ome 2 vue.js vuex apollo-client nuxt.js vue-apollo
我想在 vuex 商店中存储来自登录操作的用户。但是没有访问权限this.$apollo。
export const actions = {
UPSERT_USER({ commit }, { authUser, claims }) {
this.$apollo
.mutate({
mutation: UPSERT_USER_MUTATION,
variables: {
id: user.uid,
email: user.email,
name: user.name,
picture: user.picture,
},
})
}
Run Code Online (Sandbox Code Playgroud)
谢谢!
您应该能够像这样访问它:
export default {
actions: {
foo (store, payload) {
let client = this.app.apolloProvider.defaultClient
}
}
}
Run Code Online (Sandbox Code Playgroud)
查看https://github.com/nuxt-community/apollo-module
| 归档时间: |
|
| 查看次数: |
2040 次 |
| 最近记录: |