Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import Relay from 'react-relay'
export default class RemoveTodoMutation extends Relay.Mutation {
static fragments = {
// TODO: Mark complete as optional
todo: () => Relay.QL`
fragment on Todo {
complete,
id,
}
`,
// TODO: Mark completedCount and totalCount as optional
viewer: () => Relay.QL`
fragment on Viewer {
id,
}
`,
}
getMutation () {
import Relay from 'react-relay';
export default class extends Relay.Mutation {
static fragments = {
viewer: () => Relay.QL`fragment on Viewer { id }`
}
getMutation() {
return Relay.QL`mutation { updateWidget }`;
}
// receives the parameters from the constructor, builds
// the variables to send the GraphQL server
getVariables() {
return {
widget: {
// id is included because we are updating, input type must accept id
id: this.props.id,
import Relay from 'react-relay';
import showdown from 'showdown';
import moment from 'moment';
const converter = new showdown.Converter();
/* global App */
export default class extends Relay.Mutation {
getMutation() {
return Relay.QL`mutation{CreateComment}`;
}
getFatQuery() {
return Relay.QL`
fragment on CreateCommentPayload {
commentEdge,
post {
comments_count
}
}
`;
}
getConfigs() {
import * as React from "react"
import * as Relay from "react-relay"
interface Props {
text: string
userId: string
}
interface Response {
}
export default class AddTweetMutation extends Relay.Mutation {
getMutation () {
return Relay.QL`mutation{addTweet}`
}
getFatQuery () {
return Relay.QL`
fragment on AddTweetPayload {
tweetEdge
user
}
`
}
getConfigs () {
return [{
import Relay from 'react-relay'
export default class SigninUserMutation extends Relay.Mutation {
getMutation() {
return Relay.QL`mutation {signinUser}`
}
getFatQuery() {
return Relay.QL`fragment on SigninPayload {
token
viewer {
user
}
user
}`
}
getConfigs() {
return [
import Relay from 'react-relay';
export default class RegisterMutation extends Relay.Mutation {
static initialVariables = {
input: null
};
getMutation() {
return Relay.QL`
mutation {
createUser
}
`;
}
getVariables() {
return {
username: this.props.input.username,
password: this.props.input.password
<div>{`Revision: ${this.props.post.rev}`}</div>
<hr>
<div>
<input placeholder="Enter a post title" type="text">
</div>
<div>
<input placeholder="Enter a post body" type="text">
</div>
<hr>
<div><button>Update</button></div>
)
}
}
class PostMutation extends Relay.Mutation {
getVariables() {
return {
id: this.props.id,
rev: this.props.rev,
title: this.props.title,
body: this.props.body,
blogId: this.props.blogId || 'myblog',
personId: this.props.personId || 'joe'
};
}
getConfigs() {
return [{
type: 'FIELDS_CHANGE',
fieldIDs: {
post: this.props.id,
}