diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-07-17 18:03:08 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-07-17 18:03:08 +0200 |
| commit | d579a10ba169d6e95e8ea8a9d7f2821fe89bca1f (patch) | |
| tree | 324467ca4045bc09a0e8ad84d229a55ee5da60cc /animism-align/frontend/views/media/components/media.formImage.js | |
| parent | 3b8ca4ae366ad8925ded787f87350862ef18e0ca (diff) | |
media form tweaks. copy a media item to avoid typing in properties.
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, |
