I have a createObject
mutation that returns the ID of the new object.
After it returns I want to redirect to a detail page about the new object.
How can I get response fields from a mutation in the containing component using react/relay?
E.g. my createObject
page contains the mutation with code like:
var onFailure = (transaction) => {
};
var onSuccess = () => {
redirectTo('/thing/${newthing.id}'); // how can I get this ID?
};
// To perform a mutation, pass an instance of one to `Relay.Store.update`
Relay.Store.update(new AddThingMutation({
userId: this.props.userId,
title: this.refs.title.value,
}), { onFailure, onSuccess });
}
newthing
should be the object created by the mutation, but how can I get hold of it?