mirror of
https://github.com/wassname/talk.git
synced 2026-08-16 11:29:31 +08:00
Adds graph functionality for plugins
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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'});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user