replace jquery call with request

pull/3094/head
Iuri Matias 7 years ago
parent 720d861d20
commit dd78b9c227
  1. 20
      src/app/compiler/compiler-imports.js

@ -36,14 +36,18 @@ module.exports = {
// replace ipfs:// with /ipfs/ // replace ipfs:// with /ipfs/
url = url.replace(/^ipfs:\/\/?/, 'ipfs/') url = url.replace(/^ipfs:\/\/?/, 'ipfs/')
return $.ajax({ type: 'GET', url: 'https://gateway.ipfs.io/' + url }) return request.get(
.done(function (data) { {
cb(null, data, url) url: 'https://gateway.ipfs.io/' + url,
}) headers: {
.fail(function (xhr, text, err) { 'User-Agent': 'Remix'
// NOTE: on some browsers, err equals to '' for certain errors (such as offline browser) }
cb(err || 'Unknown transport error') }, (err, r, data) => {
}) if (err) {
return cb(err || 'Unknown transport error')
}
cb(null, data, url)
})
}, },
handlers: function () { handlers: function () {

Loading…
Cancel
Save