Adds graph functionality for plugins

This commit is contained in:
Belen Curcio
2017-03-29 19:11:43 -03:00
parent 4ca2a48bc9
commit 9df334866d
5 changed files with 50 additions and 4 deletions
@@ -0,0 +1,13 @@
import {graphql} from 'react-apollo';
import POST_RESPECT from './postRespect.graphql';
export const postRespect = graphql(POST_RESPECT, {
props: ({mutate}) => ({
postRespect: (respect) => {
return mutate({
variables: {
respect
}
});
}})
});
@@ -0,0 +1,10 @@
mutation CreateRespect ($respect: CreateRespectInput!) {
createRespect(respect: $respect) {
respect {
id
}
errors {
translation_key
}
}
}
+9 -2
View File
@@ -1,5 +1,12 @@
const typeDefs = require('./server/typeDefs');
module.exports = {
typeDefs
};
typeDefs,
resolvers: {
RootMutation: {
createRespect(_, {respect: {item_id, item_type}}, {mutators: {Action}}) {
return Action.create({item_id, item_type, action_type: 'RESPECT'});
}
}
}
};