From e247aa4e05dc404214c09e7e54fb7d491c4bbb1d Mon Sep 17 00:00:00 2001 From: clsr Date: Thu, 16 Jun 2016 17:01:01 +0000 Subject: Fix upload error display --- static/pomf.js | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'static/pomf.js') diff --git a/static/pomf.js b/static/pomf.js index dfa047a..361ffec 100644 --- a/static/pomf.js +++ b/static/pomf.js @@ -74,22 +74,15 @@ document.addEventListener('DOMContentLoaded', function() { row.appendChild(url); var link = document.createElement('a'); + var response = JSON.parse(xhr.responseText); if (respStatus === 200) { - var response = JSON.parse(xhr.responseText); - if (response.success) { - link.textContent = response.files[0].url.replace(/.*?:\/\//g, ""); - link.href = response.files[0].url; - url.appendChild(link); - } else { - bar.innerHTML = 'Error: ' + response.reason; - } - } else if (respStatus === 413) { - link.textContent = 'File Too big!'; - url.appendChild(link); + link.textContent = response.files[0].url.replace(/.*?:\/\//g, ""); + link.href = response.files[0].url; } else { - link.textContent = 'Server error!'; - url.appendChild(link); + link.textContent = response.description || 'Server error!'; + bar.innerHTML = 'Error: ' + response.description; } + url.appendChild(link); } function uploadFile(file, row) { -- cgit