How to use the isomorphic-fetch.bind function in isomorphic-fetch

To help you get started, we’ve selected a few isomorphic-fetch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DevAlien / dripr-ui / src / utils / request.js View on Github external
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);
  }
github ListnPlay / riot-isomorphic / src / app / util / fetch.js View on Github external
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
    }
github tommy351 / redux-example / src / utils / request.js View on Github external
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);
  }
github Legitcode / react-fetch / src / react-fetch.js View on Github external
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);
    }
  }