//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="" }}
="">