examples/demo-app/src/actions.js
function loadRemoteRawData(url) {
  if (!url) {
    // TODO: we should return reject with an appropriate error
    return Promise.resolve(null)
  }

  return new Promise((resolve, reject) => {
    request(url, (error, result) => {
      if (error) {
        reject(error);
      }
      const responseError = detectResponseError(result);
      if (responseError) {
        reject(responseError);
        return;
      }
      resolve(result.response)
    })
  });
}
function loadRemoteRawData(url) {
  if (!url) {
    // TODO: we should return reject with an appropriate error
    return Promise.resolve(null)
  }

  return new Promise((resolve, reject) => {
    request(url, (error, result) => {
      if (error) {
        reject(error);
      }
      const responseError = detectResponseError(result);
      if (responseError) {
        reject(responseError);
        return;
      }
      resolve(result.response)
    })
  });
}
function loadRemoteRawData ( url ) { if ( ! url ) { // TODO: we should return reject with an appropriate error return Promise . resolve ( null ) } return new Promise ( ( resolve , reject ) => { request ( url , ( error , result ) => { if ( error ) { reject ( error ) ; } const responseError = detectResponseError ( result ) ; if ( responseError ) { reject ( responseError ) ; return ; } resolve ( result . response ) } ) } ) ; }
Load a file from a remote URL
@param url
@returns {Promise<any>}
Load a file from a remote URL