-
Notifications
You must be signed in to change notification settings - Fork 5
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
Still work, when don't use import? #44
Comments
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()
}
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have 2 schema
Assignee and Task
It work fine.
But still work, if I remove
#import ....
?Could explain me?
(I use
merge-graphql-schemas
to merge)The text was updated successfully, but these errors were encountered: