I wrote a react-native app with an express.js backend. Now I wanted to create an asp.net (WebApi) backend for this app. Both have the same endpoints, but the response from the asp.net backend doesnt work in react-native. The response.json() gives me promise and not the json value.
I already changed the return type of my controller, but nothing changed. If I query the api with PostMan everything looks right.
In the app:
fetch(`${URL}/job/load/${id}`)
.then((response) => {
const result = response.json();
resolve(result);
});
Controller:
public object Load(int job) {
bool exist = DoesJobExist(job);
return Ok(new { exist = exist });
}
The result should be { exist: true }