Created
August 24, 2018 14:58
-
-
Save mcfiredrill/28e9e3fddf44dd6eecdfa6a80fb023dc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
saveImage(signedId){ | |
let image; | |
const finishSavingImage = (upload) => { | |
image = this.get('store').createRecord('image', { upload: upload }); | |
this.set(image, 'file', signedId); | |
image.save().then(() => { | |
upload.get('images').pushObject(image); | |
this.set('upload', upload); | |
}); | |
}; | |
if(!this.get('upload')){ | |
const upload = this.store.createRecord('upload'); | |
upload.save().then(() => { | |
finishSavingImage(upload); | |
}); | |
}else{ | |
const upload = this.get('upload'); | |
finishSavingImage(upload); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment