ecom/frontend/src/components/products/NewProductImage.js
// Add images to list on components did update
Add images to list on components did update
Add images to list on components did update
componentDidUpdate() {
    if (this.props.mode_select_edit) {
      if (this.state.imagesLoaded) {
        var images = this.props.savedProductPictures.map(
          (img) => img["image_name"]
        );
        console.log("Images");
        console.log(images);
        let imgCopy = images.slice(); 
        this.setState({
          displayProductPictures: imgCopy,
        });
        this.setState({
          imagesLoaded: false,
          displayImages: true,
        });
      }
      this.props.selectEditMode(false);
    }
    this.props.updateDisplayEditImages(this.state.displayProductPictures);
  }
componentDidUpdate ( ) { if ( this . props . mode_select_edit ) { if ( this . state . imagesLoaded ) { var images = this . props . savedProductPictures . map ( ( img ) => img [ "image_name" ] ) ; console . log ( "Images" ) ; console . log ( images ) ; let imgCopy = images . slice ( ) ; this . setState ( { displayProductPictures : imgCopy , } ) ; this . setState ( { imagesLoaded : false , displayImages : true , } ) ; } this . props . selectEditMode ( false ) ; } this . props . updateDisplayEditImages ( this . state . displayProductPictures ) ; }
Add images to list on components did update
Add images to list on components did update
// If the cureent mode is edit product , get product pictures // Get images //creates the clone of the state // Cache images into memery