Search code examples
admin-on-rest

Resource maps Show to /:id instead of /:id/show


Don't know why this is happening, but when click on show button, the server will receive a GET request of url /:id instead of /:id/show. The REST client is jsonServerRestClient. I use Resource component as the document describes. like:

<Resource list={MyList} edit={MyEdit} show={MyShow} />


Solution

  • If you look at the docs of jsonServerRestClient https://marmelab.com/admin-on-rest/RestClients.html#json-server-rest

    You will note that the GET_ONE rest type will generate /:id url to the server only. Show is not a rest type.