-
Notifications
You must be signed in to change notification settings - Fork 52
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
Use plugin-graphql with SSR #92
Comments
Hi! My import Vuex from 'vuex';
import VuexORM from '@vuex-orm/core';
import VuexORMGraphQL from '@vuex-orm/plugin-graphql';
import { HttpLink } from 'apollo-link-http';
import database from './database';
import fetch from 'node-fetch';
const options = {
database,
debug: process.env.NODE_ENV === 'development' && process.client,
url: process.env.BACKEND_URL + '/api/v2',
};
if (process.server) {
options.link = new HttpLink({ uri: options.url, fetch });
}
VuexORM.use(VuexORMGraphQL, options);
export default function createStore () {
const plugins = [VuexORM.install(database)];
return new Vuex.Store({ plugins });
} Seems you're right, setting Please let me know if this fixes your problem. |
That was it! Thank you :) |
Nice, I'll update the docs :) |
Done. |
Work like a charm. Don't you think it would be worth adding this as a separate page into the documentation (or at least to the setup page) instead of only the F.A.Q? SSR is quite a fundamental part of modern web applications and it took me quite some time finding this issue here for the concrete solution. |
That's exactly what I have done 😎 https://github.com/vuex-orm/plugin-graphql/blob/master/docs/guide/nuxt.md It's just not deployed yet :) |
🆒 🆒 🆒 :) |
I can not use fetch, customQuery or customMutate on Nuxt. Any one same? |
Hello, I'm trying to use plugin-graphql with fresh nuxt.js app but details about that are not sufficient. I can see in FAQ that i need to use node-fetch and
global.fetch = fetch
but where exactly should i put that? In the store file definition? So far, mystore/index.js
looks as follows:but app freezes (loading till infinity) when i'm trying to reach it in browser. Any tips much appreciated!
I'm using
plugin-graphql ^1.0.0-rc.33
The text was updated successfully, but these errors were encountered: