componentDidMount() {
let myHeaders = new Headers();
myHeaders.append("authorization", "Token e3019694305911088a8d7add7f88b05af31cbe03");
let myInit = {
method: 'GET',
headers: myHeaders
};
let myRequest = new Request('http://data.gov.spb.ru/api/v1/datasets/', myInit);
fetch(myRequest).then(res => res.json())
.then( (myBlob) => {
console.log(myBlob);
}).catch((e) => {
console.log(e);
})
}
Failed to load
http://data.gov.spb.ru/api/v1/datasets/: Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed. Origin 'http://localhost:3000' is therefore not allowed access. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.