Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const onFailure = (transaction) => {
const error = transaction.getError();
// eslint-disable-next-line no-console
console.error(`Error performing Memebuster mutation: ${error}`);
this.setState({ pending: false });
};
const onSuccess = () => {
this.setState({ pending: false });
};
const annotation = this.getLastSaveAnnotation();
if (!annotation) {
Relay.Store.commitUpdate(
new CreateMemebusterMutation({
image: imageFile,
parent_type: 'project_media',
annotator: this.getContext().currentUser,
annotated: this.props.media,
annotation: {
action,
fields,
annotated_type: 'ProjectMedia',
annotated_id: this.props.media.dbid,
},
}),
{ onFailure, onSuccess },
);
} else {
Relay.Store.commitUpdate(
handleAccessLevelChange = (accessLevel) => {
this.setState({ savingNewAccessLevel: accessLevel });
const mutation = new TeamPipelineUpdateMutation({
teamPipeline: this.props.teamPipeline,
accessLevel: accessLevel
});
Relay.Store.commitUpdate(mutation, {
onSuccess: () => {
// Hide the saving spinner
this.setState({ savingNewAccessLevel: null });
},
onFailure: (transaction) => {
// Hide the saving spinner
this.setState({ savingNewAccessLevel: null });
// Show the mutation error
FlashesStore.flash(FlashesStore.ERROR, transaction.getError());
}
});
};
performRemove = () => {
this.setState({ removing: true });
const mutation = new TeamMemberDeleteMutation({
teamMember: this.props.teamMember
});
Relay.Store.commitUpdate(mutation, {
onFailure: (transaction) => {
// Remove the "removing" spinner
this.setState({ removing: false });
// Show the mutation error
FlashesStore.flash(FlashesStore.ERROR, transaction.getError());
}
});
}
}
this.props.relay.setVariables({ pipelineAddSearch: '' });
const query = Relay.QL`mutation TeamPipelineCreateMutation {
teamPipelineCreate(input: $input) {
clientMutationId
}
}`;
const variables = {
input: {
teamID: this.props.team.id,
pipelineID: pipeline.id
}
};
const mutation = new Relay.GraphQLMutation(query, variables, null, Relay.Store, {
onFailure: this.handleMutationFailure,
onSuccess: this.handleMutationSuccess
});
mutation.commit();
};
handleRequestDeleteAccount() {
const { user } = this.props;
const onFailure = (transaction) => {
const fallbackMessage = this.props.intl.formatMessage(globalStrings.unknownError, { supportEmail: stringHelper('SUPPORT_EMAIL') });
const message = getErrorMessage(transaction, fallbackMessage);
this.setState({ message });
};
const onSuccess = () => {
logout();
};
Relay.Store.commitUpdate(
new DeleteCheckUserMutation({
id: user.dbid,
}),
{ onSuccess, onFailure },
);
}
export default connect()((props: mixed) => (
));
const fallbackMessage = this.props.intl.formatMessage(globalStrings.unknownError, { supportEmail: stringHelper('SUPPORT_EMAIL') });
const message = getErrorMessage(transaction, fallbackMessage);
this.context.setMessage(message);
};
const onSuccess = () => {
const message = (
);
this.context.setMessage(message);
};
Relay.Store.commitUpdate(
new UpdateProjectMutation({
id: this.props.project.id,
assigned_to_ids: selected.join(','),
}),
{ onSuccess, onFailure },
);
this.handleClose();
};
const Root = (props: mixed) => (
);
this.setState({ message });
};
const onSuccess = (response) => {
const appName = mapGlobalMessage(this.props.intl, 'appNameHuman');
const { createTeamUser: { team_user: { status } } } = response;
const message = status === 'member' ? messages.autoApprove : messages.success;
this.setState({
message: this.props.intl.formatMessage(message, {
team: this.props.team.name, appName,
}),
requestStatus: status,
});
};
Relay.Store.commitUpdate(
new CreateTeamUserMutation({
team_id: this.props.team.dbid,
user_id: this.getContext().currentUser.dbid,
status: 'requested',
}),
{ onSuccess, onFailure },
);
}
handleSubmit = (value) => {
const onFailure = (transaction) => {
const fallbackMessage = this.props.intl.formatMessage(globalStrings.unknownError, { supportEmail: stringHelper('SUPPORT_EMAIL') });
const message = getErrorMessage(transaction, fallbackMessage);
this.setState({ message, isSubmitting: false, dialogOpen: true });
};
const onSuccess = () => {
this.setState({ message: null, isSubmitting: false });
};
const context = new CheckContext(this).getContextStore();
Relay.Store.commitUpdate(
new CreateProjectMediaMutation({
...value,
context,
project: this.props.media.project,
team: this.props.media.team,
related: this.props.media,
related_to_id: this.props.media.dbid,
targets_count: this.props.media.relationships.targets_count,
relationships_target_id: this.props.media.relationships.target_id,
relationships_source_id: this.props.media.relationships.source_id,
}),
{ onSuccess, onFailure },
);
this.setState({ isSubmitting: true, dialogOpen: false });
};