Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
uploadFiles (files) {
robodog.upload({
waitForEncoding: true,
params: {
auth: { key: TRANSLOADIT_EXAMPLE_KEY },
template_id: TRANSLOADIT_EXAMPLE_TEMPLATE
}
}).then((result) => {
// Was cancelled
if (result == null) return
this.insertAttachments(
this.matchFilesAndThumbs(result.results)
)
}).catch((err) => {
console.error(err)
this.reportUploadError(err)
})
}
uploadFiles (files) {
robodog.upload(files, {
waitForEncoding: true,
params: {
auth: { key: TRANSLOADIT_EXAMPLE_KEY },
template_id: TRANSLOADIT_EXAMPLE_TEMPLATE
}
}).then((result) => {
if (result === null) return
this.insertAttachments(
this.matchFilesAndThumbs(result.results)
)
}).catch((err) => {
console.error(err)
this.reportUploadError(err)
})
}
window.doUpload = (event) => {
const resultEl = document.querySelector('#upload-result')
const errorEl = document.querySelector('#upload-error')
robodog.upload(event.target.files, {
waitForEncoding: true,
params: {
auth: { key: TRANSLOADIT_KEY },
template_id: TEMPLATE_ID
}
}).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
})
}