Hook step2 uploading

This commit is contained in:
Kristian Polso 2018-06-08 12:12:49 +03:00
parent 1ceba0b035
commit 5a6ccf22cb
2 changed files with 26 additions and 4 deletions

View file

@ -20,7 +20,7 @@
</div>
<form class="hook__page__content__meme right">
<form class="hook__page__content__meme right" v-on:submit.prevent="submit">
<h2>Image Text</h2>
@ -81,7 +81,7 @@
</fieldset>
<fieldset>
<input type="submit" class="__button-black" v-on:click="submit" value="Submit"/>
<input type="submit" class="__button-black" value="Submit"/>
</fieldset>
</form>
@ -167,8 +167,15 @@ export default {
ctx.fillText(this.bottomLine.toUpperCase(), canvasWidth / 2, (canvasHeight - 40));
},
submit () {
// TODO: Do the upload
EventBus.$emit('HookFileUploaded', 'txhashhere');
var component = this;
component.isLoading = true;
component.$http.post('https:/lbry.tech/upload-image', document.getElementById('meme-canvas').toDataURL('image/png')).then(function(response) {
component.isLoading = false;
console.log(response);
});
//EventBus.$emit('HookFileUploaded', 'txhashhere');
},
imagesLoaded (instance) {
var component = this;

View file

@ -102,6 +102,21 @@ app.get('/github-feed', function(req, res) {
});
app.post('/upload-image', function(req, res) {
request({
method: "PUT",
url: "http://daemon.lbry.tech/images.php",
qs: {
access_token: process.env.LBRY_DAEMON_ACCESS_TOKEN
},
body: req.body,
}, function(error, response, body) {
res.json(body);
});
});
app.get('/*', function(req, res) {
if(fs.existsSync(__dirname + "/.vuepress/dist" + req.path + ".html")) {