Reputation: 3
I am new to reach admin. So, I have an api call that return response like below.
{ "data": { "type": "someType", "id": "userid", "attributes": { "credit": 0 } } }
I am trying to display the response on an website page. This the code i am using to diplay:
<ReferenceManyField addLabel={false} reference="someType" target="users">
<SingleFieldList linkType={false}>
<TextField source='credit' label='User ID' />
</SingleFieldList>
</ReferenceManyField>
Error: The response to 'getManyReference' must be like { data : [...] }, but the received data is not an array. The dataProvider is probably wrong for 'getManyReference'
So, My response is not a array of collection.
Upvotes: 0
Views: 520
Reputation: 1866
You can do one of two things:
1. Change the API Response, if you have control over the API code
Make the response return an array for the data
field like:
{"data": [.....]}
2. Convert the API response to the above format clientside after you receive it If you can't change the API code then just modify the format of the data into what you need it to be on the client.
Upvotes: 1