Commit 91e7763c authored by Iuri Matias's avatar Iuri Matias

replace jquery call with request

parent 6caf5a15
...@@ -36,14 +36,18 @@ module.exports = { ...@@ -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 () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment