Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function commit(
environment: Environment,
complete: boolean,
todos: TodoList_viewer["todos"],
user: TodoList_viewer,
) {
return commitMutation(environment, {
mutation,
variables: {
input: { complete },
},
optimisticResponse: getOptimisticResponse(complete, todos, user),
})
}
function commit(
input: UserRegisterWithEmailInput,
onCompleted: (response: UserRegisterWithEmailMutationResponse) => void,
onError: (error: Error) => void
) {
return commitMutation(Environment, {
mutation,
variables: {
input
},
onCompleted,
onError
});
}
function commit({ environment, onCompleted, onError }) {
const variables = { input: {} }
commitMutation(environment, {
mutation,
variables,
onCompleted,
onError,
})
}
export const updateJSONURLMutation = (
environment: Environment,
options: UpdateJSONURLMutationOptions,
onCompleted: (res: any) => void
) =>
commitMutation(environment, {
mutation,
variables: options,
onError: err => {
throw err
},
onCompleted,
})
handleFollow() {
const { artist, user, relay } = this.props
if (user && user.id) {
commitMutation(relay.environment, {
mutation: graphql`
mutation FollowArtistMutation($input: FollowArtistInput!) {
followArtist(input: $input) {
artist {
__id
is_followed
}
}
}
`,
variables: {
input: {
artist_id: artist.id,
unfollow: artist.is_followed,
},
},
export default (
variables: EditUserMutationVariables,
callbacks?: MutationCallbacks,
updater?: SelectorStoreUpdater,
) => {
const {onCompleted, onError} = callbacks ? callbacks : {};
commitMutation(RelayEnvironemnt, {
mutation,
variables,
updater,
onCompleted,
onError,
});
};
return new Promise((resolve, reject) =>
commitMutation(createEnvironment(), {
mutation,
variables,
onCompleted: () => resolve(),
onError: error => reject(error),
}),
);