express-crud-router icon indicating copy to clipboard operation
express-crud-router copied to clipboard

Update id - ra.notification.data_provider_error

Open VladimirSiv opened this issue 4 years ago • 0 comments

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!

VladimirSiv avatar Nov 29 '20 14:11 VladimirSiv