Skip to content

Commit

Permalink
Fix response processing
Browse files Browse the repository at this point in the history
  • Loading branch information
talyguryn committed Mar 13, 2019
1 parent 2251a51 commit 4d25f6f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dist/bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@editorjs/image",
"version": "2.1.1",
"version": "2.1.2",
"keywords": [
"codex editor",
"tool",
Expand Down
8 changes: 5 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,12 @@ export default class ImageTool {
* @param {UploadResponseFormat} response
*/
onUpload(response) {
if (response.success && response.file) {
this.image = response.file;
const body = response.body;

if (body.success && body.file) {
this.image = body.file;
} else {
this.uploadingFailed('incorrect response: ' + JSON.stringify(response));
this.uploadingFailed('incorrect response: ' + JSON.stringify(body));
}
}

Expand Down

0 comments on commit 4d25f6f

Please sign in to comment.