File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -10,8 +10,8 @@ Vuex-ORM and Plugin GraphQL with Nuxt.
1010``` javascript
1111export default {
1212 plugins: [
13- ' ~/plugins/vuex-orm ' ,
14- ' ~/plugins/graphql '
13+ ' ~/plugins/graphql ' ,
14+ ' ~/plugins/vuex-orm '
1515 ]
1616};
1717```
@@ -60,11 +60,17 @@ import { HttpLink } from 'apollo-link-http';
6060import fetch from ' node-fetch' ;
6161import database from ' ~/data/database' ;
6262
63- const options = { database, url: ' ...' };
63+ // The url can be anything, in this example we use the value from dotenv
64+ export default function ({ app, env: { url } }) {
65+ const apolloClient = app? .apolloProvider ? .defaultClient
66+ const options = { database, url };
6467
65- if (process .server ) {
66- options .link = new HttpLink ({ uri: options .url , fetch });
67- }
68+ if (apolloClient) {
69+ options .apolloClient = apolloClient
70+ } else {
71+ options .link = new HttpLink ({ uri: options .url , fetch });
72+ }
6873
69- VuexORM .use (VuexORMGraphQL, options);
74+ VuexORM .use (VuexORMGraphQL, options);
75+ }
7076` ` `
You can’t perform that action at this time.
0 commit comments