File tree 1 file changed +13
-7
lines changed
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.
10
10
``` javascript
11
11
export default {
12
12
plugins: [
13
- ' ~/plugins/vuex-orm ' ,
14
- ' ~/plugins/graphql '
13
+ ' ~/plugins/graphql ' ,
14
+ ' ~/plugins/vuex-orm '
15
15
]
16
16
};
17
17
```
@@ -60,11 +60,17 @@ import { HttpLink } from 'apollo-link-http';
60
60
import fetch from ' node-fetch' ;
61
61
import database from ' ~/data/database' ;
62
62
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 };
64
67
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
+ }
68
73
69
- VuexORM .use (VuexORMGraphQL, options);
74
+ VuexORM .use (VuexORMGraphQL, options);
75
+ }
70
76
` ` `
You can’t perform that action at this time.
0 commit comments