Skip to content

Commit

Permalink
✨ Added remove media function
Browse files Browse the repository at this point in the history
  • Loading branch information
Yannick committed Jan 30, 2018
1 parent cf2b07e commit a9c3992
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/routes/editMedia/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default class EditMedia extends Component {
this.handleSave = this.handleSave.bind(this);
this.handleResetLoc = this.handleResetLoc.bind(this);
this.handleEditSave = this.handleEditSave.bind(this);
this.removeImage = this.removeImage.bind(this);

this.state = {
measurement: {},
Expand Down Expand Up @@ -59,6 +60,20 @@ export default class EditMedia extends Component {
route(`/med/${this.props.mediaId}`);
}

removeImage(e, i) {
e.preventDefault();
const measurement = { ...this.state.measurement };
// const file = this.state.file.slice();
// const fileUrl = this.state.fileUrl.slice();
// file.splice(i, 1);
// fileUrl.splice(i, 1);
measurement.images = this.state.measurement.images - 1;
measurement[`media${i}`] = null;
this.setState({
measurement,
});
}

renderImagesUI() {
const images = [];
for (let i = 0; i < this.state.measurement.images; i += 1) {
Expand Down

0 comments on commit a9c3992

Please sign in to comment.