I have an app, which im using fetch to authenticate user. it was working till few days ago and i haven't change anything. just upgraded from react 0.27 to 0.28, not fetch is not working.
i have searched for almost 2 days and i have read almost all questions in stackoverflow. most of users trying to fetch something from localhost, and when they change it to actual ip address , they get it to work.
but im not fetching anything from localhost, also mine code used to be working.
here is my code :
fetch('http://somesite.com/app/connect', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'language':'en-US',
'Authorization': 'Bearer ' + access_token,
},
body: JSON.stringify({
uid: uid,
refresh_token: refresh_token,
token: access_token,
device: device_id,
device_name: device_name,
})
})
.then((response) => response.json())
.then((responseData) => {
console.log(JSON.stringify(responseData.body))
})
.catch((err)=> {
console.log('Some errors occured');
console.log(err);
})
.done();
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…