diff --git a/examples/transloadit/index.html b/examples/transloadit/index.html index 856581ea2..4c64c265f 100644 --- a/examples/transloadit/index.html +++ b/examples/transloadit/index.html @@ -22,6 +22,7 @@ background-color: #111e33; height: 1px; } + .hidden { display: none; } .error { color: red; } #logo { height: 1em; vertical-align: middle; } @@ -98,6 +99,9 @@

+ +

+

diff --git a/examples/transloadit/main.js b/examples/transloadit/main.js index 836ea28d7..13556b883 100644 --- a/examples/transloadit/main.js +++ b/examples/transloadit/main.js @@ -1,3 +1,4 @@ +const { inspect } = require('util') const transloadit = require('@uppy/robodog') /** @@ -78,11 +79,21 @@ window.openModal = openModal */ window.doUpload = (event) => { + const resultEl = document.querySelector('#upload-result') + const errorEl = document.querySelector('#upload-error') transloadit.upload(event.target.files, { waitForEncoding: true, params: { auth: { key: '05a61ed019fe11e783fdbd1f56c73eb0' }, template_id: 'be001500a56011e889f9cddd88df842c' } - }).then(console.log, console.error) + }).then((result) => { + resultEl.classList.remove('hidden') + errorEl.classList.add('hidden') + resultEl.textContent = inspect(result.results) + }, (err) => { + resultEl.classList.add('hidden') + errorEl.classList.remove('hidden') + errorEl.textContent = err.message + }) }