diff options
Diffstat (limited to 'animism-align/frontend/views/media/components/media.formImage.js')
| -rw-r--r-- | animism-align/frontend/views/media/components/media.formImage.js | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/animism-align/frontend/views/media/components/media.formImage.js b/animism-align/frontend/views/media/components/media.formImage.js index abd0f94..4a97112 100644 --- a/animism-align/frontend/views/media/components/media.formImage.js +++ b/animism-align/frontend/views/media/components/media.formImage.js @@ -86,19 +86,23 @@ export default class MediaImageForm extends Component { // when we upload an image, if the image already exists in this "position" // on the record, we should also delete it if (this.props.data.settings[tag] && this.props.data.settings[tag].id) { - return actions.upload.destroy(this.props.data.settings[tag]) - .then(() => { - return this.uploadTaggedSize(image, tag, fn) - }) - .catch(() => { - console.log('error deleting the image') - return this.uploadTaggedSize(image, tag, fn) + return new Promise((resolve, reject) => { + actions.upload.destroy(this.props.data.settings[tag]) + .then(() => { + console.log('destroy successful') + this.uploadTaggedSize(image, tag, fn).then(data => resolve(data)) + }) + .catch(() => { + console.log('error deleting the image') + this.uploadTaggedSize(image, tag, fn).then(data => resolve(data)) + }) }) } return this.uploadTaggedSize(image, tag, fn) } uploadTaggedSize(image, tag, fn) { + console.log('uploading size', tag) const uploadData = { image, tag, |
