const html = require('choo/html'); export default function uploadComplete(state, emit) { const file = state.storage.files[state.storage.files.length - 1]; function onclick(e) { e.preventDefault(); input.select(); document.execCommand('copy'); input.selectionEnd = input.selectionStart; copyText.textContent = 'Copied!'; setTimeout(function() { copyText.textContent = 'Copy link'; }, 2000); } function uploadFile(event) { event.preventDefault(); const target = event.target; const file = target.files[0]; if (file.size === 0) { return; } emit('pushState', '/upload'); emit('addFiles', { files: [file] }); emit('upload', {}); } const input = html` `; const copyText = html` Copy link `; return html`