Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to manage DELETE response status code 204 with admin-on-rest?

I'm trying to integrate admin-on-rest with an api sending a 204 HTTP response without a body on successful DELETE.

So on DELETE I get the error message :

REST response must contain a data key

I'm using jsonServerRestClient and I wonder how could I override this client so it accepts 204 on DELETE and redirects to the list ?

like image 371
ExsiDev Avatar asked Dec 05 '25 10:12

ExsiDev


1 Answers

so, if my trivial answer was converted to comment write it more detail.

you can write your own client. add this to App.js

import customRestClient from './customRestClient'

create customRestClient.js and put code from jsonServerRestClient.js there in function convertHTTPResponseToREST you can add

console.log(response);
console.log(type);
console.log(resource);
console.log(params);

and see that response is object that contains code of response. In case block you can write your own behavior by adding DELETE. I hope, that it will help you

like image 167
Alexey Avatar answered Dec 10 '25 06:12

Alexey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!