I'm trying to fetch data from Prepr.io to my program and I want to filter on an object item. The problem what i'm facing is that i dont get all the objects in Javascript/React Native. When i'm doing the exact same request in Postman i got both the objects and when i'm doing the request in Javascript/React Native i only get one object. I want to get both the objects in Javascript but i have no idea of how i can fix this.
Javascript/React Native Fetch request:
const getVideoData = () => {
fetch('https://cdn.prepr.io/publications?fields=items{file{cdn_files},image{cdn_files}}', {
method: 'get',
headers: {
Authorization: 'Bearer abcdefg'
}
})
.then((r) => r.json())
.then((r) => {
console.log(r)
})
.catch((e) => {
console.log(e)
});
};
Javascript/React Native Expo Output:
"beschikbaar_op_route": Object {
"items": Array [
Object {
"body": "Route Groningen Stadspark",
"changed_on": "2022-03-16T14:46:33+00:00",
"created_on": "2022-02-28T12:13:10+00:00",
"id": "a3758c72-1074-4385-884e-34c4bd7d6e1d",
"label": "Tag",
"slug": "route-groningen-stadspark",
},
Postman Request: Request image Postman Output:
"beschikbaar_op_route": {
"items": [
{
"id": "a3758c72-1074-4385-884e-34c4bd7d6e1d",
"created_on": "2022-02-28T12:13:10+00:00",
"changed_on": "2022-03-16T14:46:33+00:00",
"label": "Tag",
"body": "Route Groningen Stadspark",
"slug": "route-groningen-stadspark"
},
{
"id": "cc3cbe4b-536a-40e7-b69b-8bdddc24d445",
"created_on": "2022-02-28T12:13:28+00:00",
"changed_on": null,
"label": "Tag",
"body": "Route Leeuwarden Kalverdijkje",
"slug": "route-leeuwarden-kalverdijkje"
}