lbry.tech/app/helpers/upload-image.js
ポール ウェッブ b1a5c11ddf Refactor in progress
2018-08-28 18:57:18 -05:00

26 lines
580 B
JavaScript

"use strict";
// P A C K A G E
const request = require("request-promise-native");
// E X P O R T
module.exports = exports = imageSource => new Promise((resolve, reject) => { // eslint-disable-line
return request({
body: {
authorization: process.env.LBRY_DAEMON_ACCESS_TOKEN,
image: imageSource
},
json: true,
method: "POST",
url: `${process.env.NODE_ENV === "development" ? "http://localhost:5200/image" : "https://daemon.lbry.tech/image" }`
}, (error, response, body) => {
if (error) resolve(error);
resolve(body);
});
});