Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Failed to fetch #348

Open
sugandhhgoyal opened this issue Jun 27, 2017 · 1 comment
Open

TypeError: Failed to fetch #348

sugandhhgoyal opened this issue Jun 27, 2017 · 1 comment

Comments

@sugandhhgoyal
Copy link

`import './App.css';

export default class ItemLister extends React.Component {
constructor() {
super();
this.state = { items: [] };
}

componentDidMount() {
    fetch('https://www.getpostman.com/collections/1d8df8b0b5bf27e5009b').then(result=> {
          console.log(result.json());
          this.setState({items:result.json()});
    }).catch(err => {
       console.log(err);
       this.setState({ items:[] });
    });
}

render() {        
    return(
        <div>
            <div>Items:</div>
           <div> { JSON.stringify(this.state.items)}</div>         
        </div>  
    );
}

}`
error-
Fetch API cannot load https://www.getpostman.com/collections/1d8df8b0b5bf27e5009b. The 'Access-Control-Allow-Origin' header has a value 'https://www.getpostman.com' that is not equal to the supplied origin. 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.
bundle.js:18335 TypeError: Failed to fetch

@Foxandxss
Copy link
Member

Explain, I am reading React in here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants