...
const handleSubmit = async values => {
create(
{ payload: { data: values } },
{
onSuccess: ({ data }) => {
setShowDialog(false);
// Update the comment form to target the newly created post
// Updating the ReferenceInput value will force it to reload the available posts
form.change('post_id', data.id);
onChange();
},
onFailure: ({ error }) => { // <----- should be onFailure: (error) => (without the curly braces)
notify(error.message, 'error');
}
}
);
};
...
Took me a while to figure out, I am using:
https://codesandbox.io/s/react-admin-v3-advanced-recipes-quick-createpreview-voyci?file=/src/comments/PostQuickCreateButton.js