I have this action which calls a function:
dispatch(Api({url: "my_url", method: "POST", data: data}))
Here I am passing array as a data..
import fetch from 'isomorphic-fetch'
export default function Api({url, method, headers, data}={}){
return dispatch => {
console.log(data)
console.log(url)
console.log(method)
console.log(JSON.stringify(data))
let response = fetch(url, {
mode: 'no-cors',
method: method || null,
body: data || null,
}).then(function(response) {
console.log("response");
console.log(response)
});
}
}
Here I am using fetch
with mode:'no-cors'
I guess I am passing all the arguements.. My body here is simple array that I am passing as arguement..
When I see the response it is like :
body: null
bodyUsed: false
headers: Headers
ok: false
status: 0
statusText: ""
type: "opaque"
url:""
Here my body is not being used..
What is wrong in here ? Need help
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…