From 0fc276c9b3b433d0bec9da081815a5e61e8e11a3 Mon Sep 17 00:00:00 2001 From: Elvis Date: Wed, 1 Dec 2021 15:27:17 -0800 Subject: [PATCH] Change Json response to match with Rails --- src/js/easymde.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/easymde.js b/src/js/easymde.js index 5c1e969..4884aeb 100644 --- a/src/js/easymde.js +++ b/src/js/easymde.js @@ -2379,8 +2379,8 @@ EasyMDE.prototype.uploadImage = function (file, onSuccess, onError) { onErrorSup(fillErrorMessage(self.options.errorMessages.importError)); return; } - if (this.status === 200 && response && !response.error && response.data && response.data.filePath) { - onSuccess((self.options.imagePathAbsolute ? '' : (window.location.origin + '/')) + response.data.filePath); + if (this.status === 200 || this.status === 201 && response && !response.error && response.data && response.data.slug) { + onSuccess((self.options.imagePathAbsolute ? '' : (window.location.origin + '/thumbs/')) + response.data.slug); } else { if (response.error && response.error in self.options.errorMessages) { // preformatted error message onErrorSup(fillErrorMessage(self.options.errorMessages[response.error]));