I tried Meteor, Apollo, Vue
.
Grapql playground
still show old Doc, Schema
while I changed any Schema on server?
// Cilent
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()
}
})
Please help me