I have an expo react native app, and i want to use a function from the API i made, in another project. I tested the url in Postman, and the url works fine. But i get the error: Network error failed in the app.
the klt_id and klt_name is from the Clients table. the url leads to a function that shows all the records from the Clients table.
this is what i have right now:
constructor(props){
    super(props);
    this.state ={ isLoading: true}
  }
  componentDidMount(){
    return fetch('http://127.0.0.1:8000/api/v2/klant', )
      .then((response) => response.json())
      .then((responseJson) => {
        console.log(responseJson)
        this.setState({
          isLoading: false,
          dataSource: responseJson.data,
        }, function(){
        });
      })
      .catch((error) =>{
        console.error(error);
      });
  }
  render(){
    if(this.state.isLoading){
      return(
        <View style={{flex: 1, padding: 20}}>
          <ActivityIndicator/>
        </View>
      )
    }
    return(
      <View style={{flex: 1, paddingTop:20}}>
        <FlatList
          data={this.state.dataSource}
          renderItem={({item}) => <Text>{item.klt_id}, {item.klt_name}</Text>}
          keyExtractor={({id}, index) => id}
        />
      </View>
    );
  }
}
Thanks in advance!
 
    
