Skip to content

Commit

Permalink
Personnalise le message d'envoi d'image trop lourde (#5972)
Browse files Browse the repository at this point in the history
  • Loading branch information
firm1 authored and Situphen committed Nov 8, 2020
1 parent b453053 commit 268a438
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions assets/js/editor-new.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@
}

var uploadImage = function(file, onSuccess, onError) {
var galleryUrl = '/api/galeries/' + document.body.getAttribute('data-gallery') + '/images/'
const galleryUrl = '/api/galeries/' + document.body.getAttribute('data-gallery') + '/images/'

var formData = new FormData()
formData.append('physical', file)
Expand All @@ -324,7 +324,11 @@
} else if (resp.responseJSON !== undefined) {
error = resp.responseJSON[0]
} else if (resp.responseText !== undefined) {
error = 'Erreur ' + resp.status + ' ' + resp.statusText + ' : ' + "'" + resp.responseText.split('\n')[0] + "'"
if (parseInt(resp.status) === 400) {
error = 'Quelque chose s\'est mal passé lors de l\'envoi. Votre image est peut-être trop lourde.'
} else {
error = 'Erreur ' + resp.status + ' ' + resp.statusText + ' : ' + "'" + resp.responseText.split('\n')[0] + "'"
}
} else if (resp.readyState === 0 && resp.statusText === 'error') {
error = 'Oups ! Impossible de se connecter au serveur.'
}
Expand Down

0 comments on commit 268a438

Please sign in to comment.