Hook step2 uploading
This commit is contained in:
parent
1ceba0b035
commit
5a6ccf22cb
2 changed files with 26 additions and 4 deletions
|
@ -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;
|
||||
|
|
15
server.js
15
server.js
|
@ -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")) {
|
||||
|
|
Loading…
Reference in a new issue