Replies: 1 comment 2 replies
-
ok, figured it out. I was configuring things like: import { ApolloClient, createHttpLink, InMemoryCache } from '@apollo/client/core';
import { createApolloProvider } from '@vue/apollo-option';
const csrftoken = document.querySelector('[name=csrfmiddlewaretoken]').value;
const { FIRST_GQL_URL, SECOND_GQL_URL } = window.MyAppConfig;
const firstHttpLink = createHttpLink({
uri: FIRST_GQL_URL,
headers: {
'X-CSRFToken': csrftoken,
},
});
const secondHttpLink = createHttpLink({
uri: SECOND_GQL_URL,
headers: {
'X-CSRFToken': csrftoken,
},
});
const firstClient = new ApolloClient({
firstHttpLink,
cache: new InMemoryCache(),
connectToDevTools: true,
});
const secondClient = new ApolloClient({
secondHttpLink,
cache: new InMemoryCache(),
connectToDevTools: true,
});
const firstProvider = createApolloProvider({
defaultClient: firstClient,
});
const secondProvider = createApolloProvider({
defaultClient: secondClient,
});
export default {
firstProvider,
secondProvider,
}; However, that was resulting in nothing getting executed. I dropped the import { ApolloClient, InMemoryCache } from '@apollo/client/core';
import { createApolloProvider } from '@vue/apollo-option';
const csrftoken = document.querySelector('[name=csrfmiddlewaretoken]').value;
const { FIRST_GQL_URL, SECOND_GQL_URL } = window.MyAppConfig;
const firstClient = new ApolloClient({
cache: new InMemoryCache(),
connectToDevTools: true,
uri: FIRST_GQL_URL,
headers: {
'X-CSRFToken': csrftoken,
},
});
const secondClient = new ApolloClient({
cache: new InMemoryCache(),
connectToDevTools: true,
uri: SECOND_GQL_URL,
headers: {
'X-CSRFToken': csrftoken,
},
});
const firstProvider = createApolloProvider({
defaultClient: firstClient,
});
const secondProvider = createApolloProvider({
defaultClient: secondClient,
});
export default {
firstProvider,
secondProvider,
}; |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've upgraded to v4-alpha.14 and I'd like to defer rewriting all my components that are using the options api but they don't seem to be firing the queries when the components mount. I can't tell if I have things installed / setup wrongly (I followed the docs) or if that is just the expected state of things now and I should use the compose API instead for v4.
Any advice?
Beta Was this translation helpful? Give feedback.
All reactions