Configurable id field
devvmh opened this issue · 4 comments
Currently this library assumes all records have a unique id attribute. This should be configurable instead, and shouldn't be assumed to be a number.
Hi,
I had a problem retrieving records and I found it is because my records have a unique id but it has not the "id" name. It looks like redux-crud-store needs this to fill the ids attribute and others in state. Is this what you mean with "configurable id field" ? Do you talk about the possibility to set another name for this id attribute ?
Hi, you're exactly right. I was anticipating this day haha.
I'm slowly working through removing immutable js from the lib so i dont have a lot of capacity to fix this issue. I would certainly welcome and collaborate on a pull request to implement this issue though!
If course if you own the backend server it wpukf be mich simpler to replicate the contents of your existing id field and have the unique identifier available under both keys. You could even hide this behaviour under a parameter (e.g. /api/v1/posts returns a regular response, but /api/v1/posts?include_id=true returns the same response with the id key added), and then pass that parameter to the ApiClient configuration so it's included in all requests from redux crud store to your server