nicgirault / express-crud-router

Simply expose resource CRUD (Create Read Update Delete) routes for Express & Sequelize. Compatible with React Admin Simple Rest Data Provider

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update id - ra.notification.data_provider_error

VladimirSiv opened this issue ยท 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!

๐ŸŽ‰ This issue has been resolved in version 7.0.1 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€