Working upload

This commit is contained in:
Kristian Polso 2018-06-08 14:16:24 +03:00
parent 66da437148
commit 3edc4c3965

View file

@ -12,6 +12,8 @@
<aside class="hook__page__content">
<div class="inner-wrap">
<template v-if="!isLoading">
<div class="hook__page__content__meme left">
<img v-bind:src="backgroundImage" id="base-image" alt="" />
<canvas id="meme-canvas" width="400" height="300">Sorry, canvas not supported</canvas>
@ -85,6 +87,8 @@
</fieldset>
</form>
</template>
<div class="xs12" v-if="isLoading">
<div class="loader"></div>
</div>
@ -124,6 +128,7 @@ export default {
return {
valid: false,
isLoading: false,
loadingMessage: '',
topLine: 'This is an example meme',
bottomLine: 'that I made',
title: '',
@ -169,7 +174,11 @@ export default {
submit () {
var component = this;
component.isLoading = true;
component.$http.post('https://lbry.tech/upload-image', document.getElementById('meme-canvas').toDataURL('image/jpeg', 0.6)).then(function(response) {
component.$http.post('/upload-image', document.getElementById('meme-canvas').toDataURL('image/jpeg', 0.6), {
headers: {
'Content-Type': 'text/plain'
}
}).then(function(response) {
component.isLoading = false;
console.log(response);
});