Click here to Skip to main content
15,868,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
//my fetchID is working
fetchID = async () => {)



fetchPhoto =() => {
fetch('http://127.0.0.1:8000/api/photo/' + this.state.user_id.id, {
method: 'GET',
headers: {
"Accept": "application/json",
'Content-Type': 'application/json',

}
})
.then((response) => { return response.json(); })
.then(data => {
this.setState({ image_uri: data }); // i think the problem is here and i dont know how to fix

})

.catch((error) => {
console.error(error);

});
}

What I have tried:

fetchID = async () => {
const value = await AsyncStorage.getItem('access_token');
fetch('http://127.0.0.1:8000/api/user/', {
method: 'GET',
headers: {
"Accept": "application/json",
'Content-Type': 'application/json',
'Authorization': "Bearer " + value.concat(),
}
})
.then((response) => { return response.json(); })
.then(data => {
this.setState({ user_id: data });
})

.catch((error) => {
console.error(error);

});
}



fetchPhoto =() => {
fetch('http://127.0.0.1:8000/api/photo/' + this.state.user_id.id, {
method: 'GET',
headers: {
"Accept": "application/json",
'Content-Type': 'application/json',

}
})
.then((response) => { return response.json(); })
.then(data => {
this.setState({ image_uri: data });

})

.catch((error) => {
console.error(error);

});
}




<image
source={{ uri:="" this.state.image_uri.img="" }}
="">
Posted
Comments
CHill60 19-Jun-19 11:02am    
What is your actual question?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900