Closed ralphchristianeclipse closed 7 years ago
The problem is when publishing a value it will return null on the subscribe method
export const subscriptions = model => ({ [model]: { resolve(payload) { console.log({...payload[model]}) return {...payload[model]} }, subscribe: withFilter(() => pubsub.asyncIterator( ['CREATED','UPDATED', 'DELETED'] .map(mutation => `${model.toUpperCase()}_${mutation}`)), (payload,variables) => { return payload.id === variables.id }) } })
And publishing it like this
[`update${model}`]: async(_, { id, ...args }, { models }, info) => { let result = await models[model].findById(id) await result.update(args) pubsub.publish(`${model.toUpperCase()}_UPDATED`, { [model]: args }) return result },
this is what i get received from the Subscription resolve
[nodemon] starting `babel-node src` Server started at 0.0.0.0:8080 express deprecated req.host: Use req.hostname instead src/server.js:97:88 { name: 'testerssas', description: 'test', slug: 'testerssas', fee: 0 } POST /graphql 200 59.101 ms - -
and getting this error
Noticed that [object Object] is an error
I think the problem is not returning an id on the publish but doing rather sending the args
The problem is when publishing a value it will return null on the subscribe method
And publishing it like this
this is what i get received from the Subscription resolve
and getting this error
Noticed that [object Object] is an error