replace jquery call with request

pull/1/head
Iuri Matias 7 years ago
parent 6caf5a15cd
commit 91e7763c3a
  1. 20
      src/app/compiler/compiler-imports.js

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

Loading…
Cancel
Save