Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import fetch_ from 'isomorphic-fetch';
import {merge} from 'lodash';
// Fix "Illegal invocation" error in Chrome
// https://github.com/matthew-andrews/isomorphic-fetch/pull/20
const fetch = fetch_.bind(this);
const GITHUB_BASE = 'https://api.github.com/';
function setupRequestOptions(options){
options = merge({
method: 'get',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
}, options);
if (typeof options.body === 'object'){
options.body = JSON.stringify(options.body);
}
constructor() {
this.fetch = fetch_.bind(undefined); // this solves an invocation error problem in chrome, according to https://github.com/matthew-andrews/isomorphic-fetch/pull/20
}
import fetch_ from 'isomorphic-fetch';
import {merge} from 'lodash';
// Fix "Illegal invocation" error in Chrome
// https://github.com/matthew-andrews/isomorphic-fetch/pull/20
const fetch = fetch_.bind(this);
const GITHUB_BASE = 'https://api.github.com/';
function setupRequestOptions(options){
options = merge({
method: 'get',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
}, options);
if (typeof options.body === 'object'){
options.body = JSON.stringify(options.body);
}
import React from 'react'
//this is to hack around a bug, see:
//https://github.com/matthew-andrews/isomorphic-fetch/pull/20
//import fetch from 'isomorphic-fetch'
import fetch_ from 'isomorphic-fetch';
var fetch = fetch_.bind(undefined);
export default class Fetch extends React.Component{
constructor(props){
super()
this.state = {}
this.fetchData(props)
}
componentWillReceiveProps(nextProps) {
if (nextProps.url !== this.props.url) {
this.fetchData(nextProps);
}
}