Я строю проект с реагированием и сокращением, но я не могу соединиться с моим API
. у меня есть это,Связь с API - redux
componentDidMount() {
const {dispatch} = this.props;
dispatch(fetchByQuerystring());
}
и fetchByQuerystring
является:
export function fetchByQuerystring() {
return function(dispatch) {
return fetch(`http://my_domain.dev/api`)
.then(response => response.json())
.then(json => dispatch(receiveByQuerystring(json)));
}
}
Когда я бегу, я получаю эту ошибку:
Fetch API cannot load http://my-domain.dev/api . No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ' http://localhost:3000 ' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Как я могу решить эту проблему?