The response to 'getList' must be like { data : [...] }, but the received data is not an array. The dataProvider is probably wrong for 'getList'
Response
{
"data": [
{
"id": 6,
"product_title": "Foam chair",
"product_description": "Fantastic Foam chair",
},
{
"id": 5,
"product_title": "Shinez cleaning liquid",
"product_description": "Shinez cleaning liquid shoes is good for electronics",
},
{
"id": 4,
"product_title": "Shinez cleaning liquid buy 1 get 1 free",
"product_description": "Shinez cleaning liquid shoes is a good for electronics and computers",
},
{
"id": 3,
"product_title": "Raj kiran Motor cycle",
"product_description": "Raj kiran Motor cycle old one",
},
{
"id": 2,
"product_title": "Ka ka cycle broken cycle",
"product_description": "Ka ka cycle broken into multiple pieces",
},
{
"id": 1,
"product_title": "ka ka police cap",
"product_description": "This is police cap used by ka team",
}
]
}
But still I get the
The response to 'getList' must be like { data : [...] }, but the received data is not an array. The dataProvider is probably wrong for 'getList'
here is the actual code
<BrowserRouter>
<Admin catchAll={NotFound}
dataProvider={dataProvider}
authProvider={authProvider}
loginPage={myLoginPage} >
</Admin>
</BrowserRouter>
I am using django rest framework as backend and using 'ra-data-django-rest-framework'
Need help on this. Thanks a lot.
Had a look at the following questions React-Admin "Get List" DataProvider
The response to 'GET_LIST' must be like { data : [...] }, but the received data is not an array
const fetchJson = (url, options = {}) => {
if (!options.headers) {
options.headers = new Headers({ Accept: 'application/json' });
}
// Not working even if add content-range
// Content-Range: posts 0-24/319,
//adding console.log , returns undefined here
console.log( fetchUtils.fetchJson );
return fetchUtils.fetchJson(url, options);
}
const dataProvider = drfProvider('http://127.0.0.1:8000/api', fetchJson);
Imp. info: I am receiving the response on request.
adding console.log , returns undefined.