express-crud-router
express-crud-router copied to clipboard
Update id - ra.notification.data_provider_error
Hello,
Thanks for creating this library! Helps a lot.
I've noticed that update function doesn't return id field which triggers ra.notification.data_provider_error with the following message:
The response to 'update' must be like { data: { id: 123, ... } }, but the received data does not have an 'id' key. The dataProvider is probably wrong for 'update'
It seems that update function is not compatible with ra-data-simple-rest stated here: React-Admin Data Providers
Replacing line with:
res.json({ id: (await doUpdate(req.params.id, req.body))[0] });
resolved issue for me.
Please let me know what you think. Thanks!