Open thearabbit opened 5 years ago
Hi. Maybe it was cached somewhere. I can't say without knowing you're complete setup.
thanks for your reply.
// Client
import { Meteor } from 'meteor/meteor'
import { ApolloClient } from 'apollo-client'
import { InMemoryCache } from 'apollo-cache-inmemory'
import { ApolloLink } from 'apollo-link'
import { HttpLink } from 'apollo-link-http'
import { MeteorAccountsLink } from 'meteor/apollo'
export default new ApolloClient({
link: ApolloLink.from([
new MeteorAccountsLink(),
new HttpLink({
uri: Meteor.absoluteUrl('graphql'),
}),
]),
cache: new InMemoryCache(),
defaultOptions: {
watchQuery: {
fetchPolicy: 'no-cache',
errorPolicy: 'ignore',
},
query: {
fetchPolicy: 'no-cache',
errorPolicy: 'all',
},
},
})
---------------
// Server
import { ApolloServer, AuthenticationError } from 'apollo-server-express'
import { WebApp } from 'meteor/webapp'
import { getUser } from 'meteor/apollo'
import { mergeTypes, mergeResolvers } from 'merge-graphql-schemas'
// Get schemas
import { typeDefs, resolvers } from './apollo-schema'
// Create apollo server
const server = new ApolloServer({
typeDefs: mergeTypes(typeDefs, { all: true }),
resolvers: mergeResolvers(resolvers),
context: async ({ req }) => {
const user = await getUser(req.headers.authorization)
// In the browser console, enter
// localStorage.getItem('Meteor.loginToken')
if (user) return { user }
console.log('AuthenticationError: You must be logged in')
throw new AuthenticationError('You must be logged in')
},
})
server.applyMiddleware({
app: WebApp.connectHandlers,
path: '/graphql',
})
WebApp.connectHandlers.use('/graphql', (req, res) => {
if (req.method === 'GET') {
res.end()
}
})
I have 2 schema
Assignee and Task
It work fine. But still work, if I remove
#import ....
? Could explain me? (I usemerge-graphql-schemas
to merge)